X-Git-Url: http://git.joshuawise.com/snipe.git/blobdiff_plain/5c79bb689ab446551bc7ec4497e6c9b75582837e..c148fe943397f2ec0ea1f9b6784a217213ff54c1:/parse/l5.grm?ds=inline diff --git a/parse/l5.grm b/parse/l5.grm index 7195271..bf2e261 100644 --- a/parse/l5.grm +++ b/parse/l5.grm @@ -35,6 +35,7 @@ fun make_lval (A.Var(id)) ext = id | SEMI | INTNUM of Word32.word | IDENT of Symbol.symbol + | STRING of string | RETURN | PLUS | MINUS | STAR | SLASH | PERCENT | LSH | RSH | LOGOR | LOGAND | BITAND | BITXOR | BITOR | BITNOT | BANG | ASSIGN | PLUSEQ | MINUSEQ | STAREQ | SLASHEQ | PERCENTEQ | LSHEQ | RSHEQ | BITANDEQ | BITXOREQ | BITOREQ @@ -43,7 +44,7 @@ fun make_lval (A.Var(id)) ext = id | LBRACE | RBRACE | LPAREN | RPAREN | UNARY | ASNOP (* dummy *) - | EXTERN | VAR | INT | QUESTION | COLON | COMMA | STRUCT | NULL | LBRACKET | RBRACKET | ARROW | DOT | NEW + | EXTERN | VAR | INT | TSTRING | QUESTION | COLON | COMMA | STRUCT | NULL | LBRACKET | RBRACKET | ARROW | DOT | NEW | PLUSPLUS | MINUSMINUS %nonterm @@ -103,6 +104,7 @@ programx : decls (decls) | programx function (AUP.append_function programx function) vtype : INT (T.Int) + | TSTRING (T.String) | IDENT (T.Typedef IDENT) | vtype STAR (T.Pointer vtype) | vtype LBRACKET RBRACKET @@ -184,7 +186,9 @@ block : stm ([stm]) exp : LPAREN exp RPAREN (exp) | INTNUM (mark (A.ConstExp(INTNUM),(INTNUMleft,INTNUMright))) + | STRING (mark (A.StringExp(STRING),(STRINGleft,STRINGright))) | IDENT (mark (A.Var(IDENT), (IDENTleft,IDENTright))) + | LBRACKET vtype RBRACKET exp %prec UNARY (mark (A.Cast (vtype, exp), (LBRACKETleft, expright))) | exp DOT IDENT (mark (A.Member(exp, IDENT), (expleft, IDENTright))) | exp ARROW IDENT (mark (A.DerefMember(exp, IDENT), (expleft, IDENTright))) | STAR exp %prec UNARY (mark (A.Dereference(exp), (STARleft, expright)))