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
c6e7d4e5
Commit
c6e7d4e5
authored
10 years ago
by
Manos Koukoutos
Browse files
Options
Downloads
Patches
Plain Diff
ExpressionGrammar style improvements
parent
4c5796bc
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/scala/leon/synthesis/utils/ExpressionGrammar.scala
+9
-11
9 additions, 11 deletions
src/main/scala/leon/synthesis/utils/ExpressionGrammar.scala
with
9 additions
and
11 deletions
src/main/scala/leon/synthesis/utils/ExpressionGrammar.scala
+
9
−
11
View file @
c6e7d4e5
...
@@ -13,12 +13,10 @@ import purescala.Common._
...
@@ -13,12 +13,10 @@ import purescala.Common._
import
purescala.Definitions._
import
purescala.Definitions._
import
purescala.Types._
import
purescala.Types._
import
purescala.ExprOps._
import
purescala.ExprOps._
import
purescala.DefOps._
import
purescala.TypeOps._
import
purescala.TypeOps._
import
purescala.Extractors._
import
purescala.Extractors._
import
purescala.Constructors._
import
purescala.Constructors._
import
purescala.ScalaPrinter
import
purescala.ScalaPrinter
import
purescala.Constructors.finiteSet
import
scala.language.implicitConversions
import
scala.language.implicitConversions
...
@@ -40,16 +38,15 @@ abstract class ExpressionGrammar[T <% Typed] {
...
@@ -40,16 +38,15 @@ abstract class ExpressionGrammar[T <% Typed] {
def
computeProductions
(
t
:
T
)
:
Seq
[
Gen
]
def
computeProductions
(
t
:
T
)
:
Seq
[
Gen
]
def
filter
(
f
:
Gen
=>
Boolean
)
=
{
def
filter
(
f
:
Gen
=>
Boolean
)
=
{
val
that
=
this
new
ExpressionGrammar
[
T
]
{
new
ExpressionGrammar
[
T
]
{
def
computeProductions
(
t
:
T
)
=
that
.
computeProductions
(
t
).
filter
(
f
)
def
computeProductions
(
t
:
T
)
=
ExpressionGrammar
.
this
.
computeProductions
(
t
).
filter
(
f
)
}
}
}
}
final
def
||
(
that
:
ExpressionGrammar
[
T
])
:
ExpressionGrammar
[
T
]
=
{
final
def
||
(
that
:
ExpressionGrammar
[
T
])
:
ExpressionGrammar
[
T
]
=
{
ExpressionGrammars
.
Or
(
Seq
(
this
,
that
))
ExpressionGrammars
.
Or
(
Seq
(
this
,
that
))
}
}
final
def
printProductions
(
printer
:
String
=>
Unit
)
{
final
def
printProductions
(
printer
:
String
=>
Unit
)
{
for
((
t
,
gs
)
<-
cache
;
g
<-
gs
)
{
for
((
t
,
gs
)
<-
cache
;
g
<-
gs
)
{
...
@@ -221,11 +218,12 @@ object ExpressionGrammars {
...
@@ -221,11 +218,12 @@ object ExpressionGrammars {
type
L
=
Label
[
String
]
type
L
=
Label
[
String
]
private
var
counter
=
-
1
val
getNext
:
()
=>
Int
=
{
var
counter
=
-
1
def
getNext
()
:
Int
=
{
()
=>
{
counter
+=
1
counter
+=
1
counter
counter
}
}
}
lazy
val
allSimilar
=
computeSimilar
(
e
).
groupBy
(
_
.
_1
).
mapValues
(
_
.
map
(
_
.
_2
))
lazy
val
allSimilar
=
computeSimilar
(
e
).
groupBy
(
_
.
_1
).
mapValues
(
_
.
map
(
_
.
_2
))
...
@@ -241,7 +239,7 @@ object ExpressionGrammars {
...
@@ -241,7 +239,7 @@ object ExpressionGrammars {
def
getLabel
(
t
:
TypeTree
)
=
{
def
getLabel
(
t
:
TypeTree
)
=
{
val
tpe
=
bestRealType
(
t
)
val
tpe
=
bestRealType
(
t
)
val
c
=
getNext
val
c
=
getNext
()
Label
(
tpe
,
"G"
+
c
)
Label
(
tpe
,
"G"
+
c
)
}
}
...
...
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