home
/
code
/
tiger.ml.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove stand-alone unit grammar rule
[tiger.ml.git]
/
tiger
/
src
/
lib
/
tiger
/
tiger_parser.mly
diff --git
a/tiger/src/lib/tiger/tiger_parser.mly
b/tiger/src/lib/tiger/tiger_parser.mly
index
4497ce3
..
27e051d
100644
(file)
--- a/
tiger/src/lib/tiger/tiger_parser.mly
+++ b/
tiger/src/lib/tiger/tiger_parser.mly
@@
-109,7
+109,7
@@
exp:
{
sprintf "string[%S]" $1
}
{
sprintf "string[%S]" $1
}
- | ID
unit
+ | ID
LPAREN RPAREN
{
let id = $1 in
sprintf "fun_call[%s, []]" id
{
let id = $1 in
sprintf "fun_call[%s, []]" id
@@
-161,9
+161,10
@@
exp:
let seq = $4 in
sprintf "let[decs[%s], in[seq[%s]]]" decs seq
}
let seq = $4 in
sprintf "let[decs[%s], in[seq[%s]]]" decs seq
}
- |
unit
+ |
LPAREN RPAREN
{
{
- $1
+ (* Perhaps "void"? *)
+ "unit[]"
}
seq:
}
seq:
@@
-192,18
+193,18
@@
dec:
| fundec {$1}
fundec:
| fundec {$1}
fundec:
- | FUNCTION ID
unit
EQ exp
+ | FUNCTION ID
LPAREN RPAREN
EQ exp
{
let id = $2 in
{
let id = $2 in
- let exp = $
5
in
- sprintf "fundec[%s, exp[%s]]" id exp
+ let exp = $
6
in
+ sprintf "fundec[%s,
arguments[],
exp[%s]]" id exp
}
| FUNCTION ID LPAREN tyfields RPAREN EQ exp
{
let id = $2 in
let tyfields = $4 in
let exp = $7 in
}
| FUNCTION ID LPAREN tyfields RPAREN EQ exp
{
let id = $2 in
let tyfields = $4 in
let exp = $7 in
- sprintf "fundec[%s,
tyfield
s[%s], exp[%s]]" id tyfields exp
+ sprintf "fundec[%s,
argument
s[%s], exp[%s]]" id tyfields exp
}
| FUNCTION ID LPAREN tyfields RPAREN COLON ID EQ exp
{
}
| FUNCTION ID LPAREN tyfields RPAREN COLON ID EQ exp
{
@@
-279,13
+280,6
@@
tyfield:
sprintf "tyfield[%s, %s]" id type_id
}
sprintf "tyfield[%s, %s]" id type_id
}
-/* Perhaps "void"? */
-unit:
- | LPAREN RPAREN
- {
- "unit[]"
- }
-
rec_field_assignments:
| ID EQ exp
{
rec_field_assignments:
| ID EQ exp
{
This page took
0.029863 seconds
and
4
git commands to generate.