Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LARA
inox
Commits
2e7b523f
Commit
2e7b523f
authored
12 years ago
by
Etienne Kneuss
Browse files
Options
Downloads
Patches
Plain Diff
Process management, try #2
parent
c22e2d50
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/scala/leon/synthesis/SynthesisPhase.scala
+28
-3
28 additions, 3 deletions
src/main/scala/leon/synthesis/SynthesisPhase.scala
src/main/scala/leon/synthesis/Synthesizer.scala
+16
-4
16 additions, 4 deletions
src/main/scala/leon/synthesis/Synthesizer.scala
with
44 additions
and
7 deletions
src/main/scala/leon/synthesis/SynthesisPhase.scala
+
28
−
3
View file @
2e7b523f
...
...
@@ -14,7 +14,8 @@ object SynthesisPhase extends LeonPhase[Program, PipelineControl] {
new
FairZ3Solver
(
quietReporter
)
)
val
newProgram
=
new
Synthesizer
(
ctx
.
reporter
,
solvers
).
synthesizeAll
(
p
)
val
synth
=
new
Synthesizer
(
ctx
.
reporter
,
solvers
)
val
solutions
=
synth
.
synthesizeAll
(
p
)
detectEditor
match
{
case
Some
(
program
)
=>
...
...
@@ -31,7 +32,31 @@ object SynthesisPhase extends LeonPhase[Program, PipelineControl] {
}
def
openEditor
(
program
:
String
,
path
:
String
)
{
val
p
=
sys
.
process
.
Process
(
program
+
" "
+
path
)
p
!<
val
proc
=
Runtime
.
getRuntime
().
exec
(
program
+
" "
+
path
)
val
errGobbler
=
new
StreamGobbler
(
proc
.
getErrorStream
(),
System
.
err
)
val
outGobbler
=
new
StreamGobbler
(
proc
.
getInputStream
(),
System
.
out
)
val
inGobbler
=
new
StreamGobbler
(
System
.
in
,
proc
.
getOutputStream
())
errGobbler
.
start
()
outGobbler
.
start
()
inGobbler
.
start
()
proc
.
waitFor
()
errGobbler
.
join
()
outGobbler
.
join
()
}
import
java.io.
{
InputStream
,
OutputStream
}
class
StreamGobbler
(
is
:
InputStream
,
os
:
OutputStream
)
extends
Thread
{
override
def
run
()
{
var
c
:
Int
=
is
.
read
()
while
(
c
!=
1
)
{
os
.
write
(
c
);
os
.
flush
();
c
=
is
.
read
()
}
}
}
}
This diff is collapsed.
Click to expand it.
src/main/scala/leon/synthesis/Synthesizer.scala
+
16
−
4
View file @
2e7b523f
...
...
@@ -86,8 +86,8 @@ class Synthesizer(val r: Reporter, val solvers: List[Solver]) {
(
None
,
Map
())
}
def
synthesizeAll
(
program
:
Program
)
=
{
import
purescala.Trees._
import
purescala.Trees._
def
synthesizeAll
(
program
:
Program
)
:
List
[(
Choose
,
Solution
)]
=
{
solvers
.
foreach
(
_
.
setProgram
(
program
))
...
...
@@ -95,8 +95,10 @@ class Synthesizer(val r: Reporter, val solvers: List[Solver]) {
def
noop
(
u
:
Expr
,
u2
:
Expr
)
=
u
var
solutions
=
List
[(
Choose
,
Solution
)]()
def
actOnChoose
(
f
:
FunDef
)(
e
:
Expr
,
a
:
Expr
)
:
Expr
=
e
match
{
case
Choose
(
vars
,
pred
)
=>
case
ch
@
Choose
(
vars
,
pred
)
=>
val
xs
=
vars
val
as
=
(
variablesOf
(
pred
)--
xs
).
toList
val
phi
=
pred
...
...
@@ -105,8 +107,11 @@ class Synthesizer(val r: Reporter, val solvers: List[Solver]) {
info
(
""
)
info
(
"In Function "
+
f
.
id
+
":"
)
info
(
"-"
*
80
)
val
sol
=
synthesize
(
Problem
(
as
,
phi
,
xs
),
rules
)
solutions
=
(
ch
,
sol
)
::
solutions
info
(
"Scala code:"
)
info
(
ScalaPrinter
(
simplifyLets
(
sol
.
toExpr
)))
...
...
@@ -120,6 +125,13 @@ class Synthesizer(val r: Reporter, val solvers: List[Solver]) {
treeCatamorphism
(
x
=>
x
,
noop
,
actOnChoose
(
f
),
f
.
body
.
get
)
}
program
solutions
}
def
substitueChooses
(
file
:
String
,
sols
:
List
[(
Choose
,
Solution
)])
=
{
import
scala.io.Source
val
src
=
Source
.
fromFile
(
file
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment