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
2d0578dd
Commit
2d0578dd
authored
13 years ago
by
Régis Blanc
Browse files
Options
Downloads
Patches
Plain Diff
basic support for array working
parent
176b5e7a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/scala/leon/ArrayTransformation.scala
+4
-4
4 additions, 4 deletions
src/main/scala/leon/ArrayTransformation.scala
src/main/scala/leon/purescala/PrettyPrinter.scala
+7
-7
7 additions, 7 deletions
src/main/scala/leon/purescala/PrettyPrinter.scala
with
11 additions
and
11 deletions
src/main/scala/leon/ArrayTransformation.scala
+
4
−
4
View file @
2d0578dd
...
...
@@ -31,7 +31,7 @@ object ArrayTransformation extends Pass {
case
sel
@ArraySelect
(
a
,
i
)
=>
{
val
ar
=
transform
(
a
)
val
ir
=
transform
(
i
)
val
length
=
TupleSelect
(
ar
,
2
)
val
length
=
TupleSelect
(
ar
,
2
)
.
setType
(
Int32Type
)
IfExpr
(
And
(
GreaterEquals
(
i
,
IntLiteral
(
0
)),
LessThan
(
i
,
length
)),
ArraySelect
(
TupleSelect
(
ar
,
1
),
ir
).
setType
(
sel
.
getType
),
...
...
@@ -43,12 +43,12 @@ object ArrayTransformation extends Pass {
val
ir
=
transform
(
i
)
val
vr
=
transform
(
v
)
val
Variable
(
id
)
=
ar
val
length
=
TupleSelect
(
ar
,
2
)
val
array
=
TupleSelect
(
ar
,
1
)
val
length
=
TupleSelect
(
ar
,
2
)
.
setType
(
Int32Type
)
val
array
=
TupleSelect
(
ar
,
1
)
.
setType
(
ArrayType
(
v
.
getType
))
//val Tuple(Seq(Variable(id), length)) = ar
IfExpr
(
And
(
GreaterEquals
(
i
,
IntLiteral
(
0
)),
LessThan
(
i
,
length
)),
Block
(
Seq
(
Assignment
(
id
,
Tuple
(
Seq
(
ArrayUpdated
(
array
,
i
,
v
),
length
)).
setType
(
TupleType
(
Seq
(
array
.
getType
,
Int32Type
))))),
IntLiteral
(
0
)),
Block
(
Seq
(
Assignment
(
id
,
Tuple
(
Seq
(
ArrayUpdated
(
array
,
i
,
v
)
.
setType
(
array
.
getType
)
,
length
)).
setType
(
TupleType
(
Seq
(
array
.
getType
,
Int32Type
))))),
IntLiteral
(
0
)),
Error
(
"Array out of bound access"
).
setType
(
Int32Type
)
).
setType
(
Int32Type
)
}
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/leon/purescala/PrettyPrinter.scala
+
7
−
7
View file @
2d0578dd
...
...
@@ -249,33 +249,33 @@ object PrettyPrinter {
nsb
=
ppNary
(
nsb
,
Seq
(
k
),
"("
,
","
,
")"
,
lvl
)
nsb
}
case
ArrayFill
(
size
,
v
)
=>
{
case
fill
@
ArrayFill
(
size
,
v
)
=>
{
sb
.
append
(
"Array.fill("
)
pp
(
size
,
sb
,
lvl
)
sb
.
append
(
")("
)
pp
(
v
,
sb
,
lvl
)
sb
.
append
(
")
"
)
sb
.
append
(
")
#"
+
fill
.
getType
)
}
case
ArraySelect
(
ar
,
i
)
=>
{
case
sel
@
ArraySelect
(
ar
,
i
)
=>
{
pp
(
ar
,
sb
,
lvl
)
sb
.
append
(
"("
)
pp
(
i
,
sb
,
lvl
)
sb
.
append
(
")
"
)
sb
.
append
(
")
#"
+
sel
.
getType
)
}
case
ArrayUpdate
(
ar
,
i
,
v
)
=>
{
case
up
@
ArrayUpdate
(
ar
,
i
,
v
)
=>
{
pp
(
ar
,
sb
,
lvl
)
sb
.
append
(
"("
)
pp
(
i
,
sb
,
lvl
)
sb
.
append
(
") = "
)
pp
(
v
,
sb
,
lvl
)
}
case
ArrayUpdated
(
ar
,
i
,
v
)
=>
{
case
up
@
ArrayUpdated
(
ar
,
i
,
v
)
=>
{
pp
(
ar
,
sb
,
lvl
)
sb
.
append
(
".updated("
)
pp
(
i
,
sb
,
lvl
)
sb
.
append
(
", "
)
pp
(
v
,
sb
,
lvl
)
sb
.
append
(
")
"
)
sb
.
append
(
")
#"
+
up
.
getType
)
}
case
Distinct
(
exprs
)
=>
{
...
...
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