Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
8a37cb49
Commit
8a37cb49
authored
Jul 10, 2007
by
Pietro Abate
Browse files
[r2003-08-15 10:35:24 by cvscast] Improve error message in sequences
Original author: cvscast Date: 2003-08-15 10:35:25+00:00
parent
91c75f3b
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGES
View file @
8a37cb49
since
0.1.
0
0.1.
1
* Various bug fixes
* Sequencing operator e1;e2 (equivalent to: let [] = e1 in e2)
* Encoded references
...
...
driver/examples.ml
View file @
8a37cb49
...
...
@@ -362,10 +362,10 @@ let [x] = bold [doc] in print_xml x;;
let stack = ref [Int*] []
let fun push(x : Int) : [] =
stack := [x
; !stack]
stack := [x; !stack]
let fun pop ([] : []) : Int =
match !stack with [x
; y] -> stack := y; x | _ -> raise
\"
Empty stack
\"
match !stack with [x; y] -> stack := y; x | _ -> raise
\"
Empty stack
\"
(* In a pattern [ ... ; y] the variable y captures the tail *)
...
...
@@ -373,6 +373,7 @@ let fun pop ([] : []) : Int =
(* In an expression [ ... ; e ] the expression e denotes the *)
(* tail of the sequence. It is equivalent to [ ... ] @ e *)
;;
push 1;;
...
...
parser/parser.ml
View file @
8a37cb49
...
...
@@ -263,8 +263,10 @@ EXTEND
[
c
=
const
->
exp
loc
(
Cst
c
)
|
"("
;
l
=
LIST1
expr
SEP
","
;
")"
->
exp
loc
(
tuple
l
)
|
"["
;
l
=
LIST0
seq_elem
;
e
=
OPT
[
";"
;
e
=
expr
->
e
];
(
_
,
loc_end
)
=
[
"]"
->
loc
]
->
loc_end
=
[
"]"
->
loc
]
->
let
e
=
match
e
with
Some
e
->
e
|
None
->
cst_nil
in
let
e
=
exp
loc_end
e
in
let
(
_
,
loc_end
)
=
loc_end
in
let
l
=
List
.
fold_right
(
fun
x
q
->
match
x
with
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment