diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-04-29 13:58:18 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-04-29 13:58:18 +0000 |
commit | f1d236b83003eda71e12840732d159fd23b1b771 (patch) | |
tree | 0edad805ea24f7b626d2c6fee9fc50da23acfc47 /backend | |
parent | 39df8fb19bacb38f317abf06de432b83296dfdd1 (diff) |
Integration of Jacques-Henri Jourdan's verified parser.
(Merge of branch newparser.)
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2469 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'backend')
-rw-r--r-- | backend/CMlexer.mll | 3 | ||||
-rw-r--r-- | backend/CMparser.mly | 15 |
2 files changed, 5 insertions, 13 deletions
diff --git a/backend/CMlexer.mll b/backend/CMlexer.mll index fb9173d..d1926fd 100644 --- a/backend/CMlexer.mll +++ b/backend/CMlexer.mll @@ -85,8 +85,6 @@ rule token = parse | ">>l" { GREATERGREATERL } | ">>lu" { GREATERGREATERLU } | "if" { IF } - | "in" { IN } - | "inline" { INLINE } | "int" { INT } | "int16" { INT16 } | "int16s" { INT16S } @@ -114,7 +112,6 @@ rule token = parse | "<=lu" { LESSEQUALLU } | "<<" { LESSLESS } | "<<l" { LESSLESSL } - | "let" { LET } | "long" { LONG } | "longofint" { LONGOFINT } | "longofintu" { LONGOFINTU } diff --git a/backend/CMparser.mly b/backend/CMparser.mly index f0f92f2..8c3769a 100644 --- a/backend/CMparser.mly +++ b/backend/CMparser.mly @@ -299,8 +299,6 @@ let mkmatch expr cases = %token GREATERGREATERLU %token <string> IDENT %token IF -%token IN -%token INLINE %token INT %token INT16 %token INT16S @@ -329,7 +327,6 @@ let mkmatch expr cases = %token LESSEQUALLU %token LESSLESS %token LESSLESSL -%token LET %token LONG %token <int64> LONGLIT %token LONGOFINT @@ -378,10 +375,8 @@ let mkmatch expr cases = %token WHILE /* Precedences from low to high */ - -%left COMMA -%left p_let -%right EQUAL +%nonassoc p_THEN +%nonassoc ELSE %left BAR BARL %left CARET CARETL %left AMPERSAND AMPERSANDL @@ -389,7 +384,7 @@ let mkmatch expr cases = %left LESSLESS GREATERGREATER GREATERGREATERU LESSLESSL GREATERGREATERL GREATERGREATERLU %left PLUS PLUSF PLUSL MINUS MINUSF MINUSL %left STAR SLASH PERCENT STARF SLASHF SLASHU PERCENTU STARL SLASHL SLASHLU PERCENTL PERCENTLU -%nonassoc BANG TILDE TILDEL p_uminus ABSF INTOFFLOAT INTUOFFLOAT FLOATOFINT FLOATOFINTU INT8S INT8U INT16S INT16U FLOAT32 ALLOC INTOFLONG LONGOFINT LONGOFINTU LONGOFFLOAT LONGUOFFLOAT FLOATOFLONG FLOATOFLONGU +%nonassoc BANG TILDE TILDEL p_uminus ABSF INTOFFLOAT INTUOFFLOAT FLOATOFINT FLOATOFINTU INT8S INT8U INT16S INT16U FLOAT32 INTOFLONG LONGOFINT LONGOFINTU LONGOFFLOAT LONGUOFFLOAT FLOATOFLONG FLOATOFLONGU %left LPAREN /* Entry point */ @@ -528,7 +523,7 @@ stmt: | memory_chunk LBRACKET expr RBRACKET EQUAL expr SEMICOLON { mkstore $1 $3 $6 } | IF LPAREN expr RPAREN stmts ELSE stmts { mkifthenelse $3 $5 $7 } - | IF LPAREN expr RPAREN stmts { mkifthenelse $3 $5 Sskip } + | IF LPAREN expr RPAREN stmts %prec p_THEN { mkifthenelse $3 $5 Sskip } | LOOP stmts { Sloop($2) } | LBRACELBRACE stmt_list RBRACERBRACE { Sblock($2) } | EXIT SEMICOLON { Sexit O } @@ -672,7 +667,7 @@ expr_list: ; expr_list_1: - expr %prec COMMA { $1 :: [] } + expr { $1 :: [] } | expr COMMA expr_list_1 { $1 :: $3 } ; |