by removing a stand-alone type_id definition, which seems to have conflicted
with id definition
{
sprintf "negation[%s]" $2
}
{
sprintf "negation[%s]" $2
}
- | type_id LBRACK exp RBRACK OF exp
+ | ID LBRACK exp RBRACK OF exp
- sprintf "array[type[%s], size[%s], val[%s]]" $1 $3 $6
+ let type_id = $1 in
+ let exp_1 = $3 in
+ let exp_2 = $6 in
+ sprintf "array[type[%s], size[%s], val[%s]]" type_id exp_1 exp_2
- | type_id LBRACE rec_field_assignments RBRACE
+ | ID LBRACE rec_field_assignments RBRACE
- sprintf "record[type[%s], rec_field_assignments[%s]]" $1 $3
+ let type_id = $1 in
+ let rec_field_assignments = $3 in
+ sprintf
+ "record[type[%s], rec_field_assignments[%s]]"
+ type_id rec_field_assignments
+ | FUNCTION id unit EQ exp
+ {
+ let id = $2 in
+ let exp = $5 in
+ sprintf "fundec[%s, exp[%s]]" id exp
+ }
| FUNCTION id LPAREN tyfields RPAREN EQ exp
{
let id = $2 in
| FUNCTION id LPAREN tyfields RPAREN EQ exp
{
let id = $2 in
let exp = $7 in
sprintf "fundec[%s, tyfields[%s], exp[%s]]" id tyfields exp
}
let exp = $7 in
sprintf "fundec[%s, tyfields[%s], exp[%s]]" id tyfields exp
}
- | FUNCTION id LPAREN tyfields RPAREN COLON type_id EQ exp
+ | FUNCTION id LPAREN tyfields RPAREN COLON ID EQ exp
{
let id = $2 in
let tyfields = $4 in
{
let id = $2 in
let tyfields = $4 in
let exp = $4 in
sprintf "vardec[%s, exp[%s]]" id exp
}
let exp = $4 in
sprintf "vardec[%s, exp[%s]]" id exp
}
- | VAR id COLON type_id ASSIGN exp
+ | VAR id COLON ID ASSIGN exp
- sprintf "vardec[%s, type_id[%s], exp[%s]]" id tyid exp
+ sprintf "vardec[%s, type_id[%s], exp[%s]]" id type_id exp
- sprintf "tydec[%s, %s]" $2 $4
+ let type_id = $2 in
+ let ty = $4 in
+ sprintf "tydec[%s, %s]" type_id ty
+ | ID
+ {
+ let type_id = $1 in
+ sprintf "type[type_id[%S]]" type_id
+ }
| LBRACE RBRACE
{
"record[]"
| LBRACE RBRACE
{
"record[]"
let tyfields = $2 in
sprintf "record[%s]" tyfields
}
let tyfields = $2 in
sprintf "record[%s]" tyfields
}
{
let type_id = $3 in
sprintf "array_of_type[%s]" type_id
{
let type_id = $3 in
sprintf "array_of_type[%s]" type_id
{
let id = $1 in
let type_id = $3 in
{
let id = $1 in
let type_id = $3 in
-type_id:
- | id
- {
- sprintf "type_id[%S]" $1
- }
-
rec_field_assignments:
| id EQ exp
{
rec_field_assignments:
| id EQ exp
{