Add string pasting support to the gramamr. blargcpu
authorJoshua Wise <jwise@andrew.cmu.edu>
Sat, 25 Dec 2010 06:24:07 +0000 (01:24 -0500)
committerJoshua Wise <jwise@andrew.cmu.edu>
Sat, 25 Dec 2010 06:24:07 +0000 (01:24 -0500)
parse/l5.grm

index bf2e261..75c8bc9 100644 (file)
@@ -51,6 +51,7 @@ fun make_lval (A.Var(id)) ext = id
    program of A.program
  | programx of A.program
  | stms of A.stm list
+ | stringcat of string
  | stm of A.stm
  | simp of A.stm
  | return of A.stm
@@ -184,9 +185,12 @@ simpoption :                        (NONE)
 block      : stm                    ([stm])
            | LBRACE stms RBRACE     (stms)
 
+stringcat  : STRING                 (STRING)
+           | STRING stringcat       (STRING ^ stringcat)
+
 exp        : LPAREN exp RPAREN      (exp)
            | INTNUM                 (mark (A.ConstExp(INTNUM),(INTNUMleft,INTNUMright)))
-           | STRING                 (mark (A.StringExp(STRING),(STRINGleft,STRINGright)))
+           | stringcat              (mark (A.StringExp(stringcat),(stringcatleft,stringcatright)))
            | 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)))
This page took 0.020762 seconds and 4 git commands to generate.