diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2013-01-07 10:30:16 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2013-01-07 10:30:16 +0000 |
commit | 8e5f68c1a6d921a46bb817fe0a82fca1c3494dde (patch) | |
tree | 2cec8321fd218a49c6cc8ec70b9f9d37634ef43f /backend/CMlexer.mll | |
parent | 578cc2a54897e0c89425a56df7a173bebeee2382 (diff) | |
download | compcert-8e5f68c1a6d921a46bb817fe0a82fca1c3494dde.tar.gz compcert-8e5f68c1a6d921a46bb817fe0a82fca1c3494dde.zip |
Update Cminor parser and printer so that the parser can parse the whole Cminor language and can reparse the output of the printer.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2090 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'backend/CMlexer.mll')
-rw-r--r-- | backend/CMlexer.mll | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/backend/CMlexer.mll b/backend/CMlexer.mll index 2eaa4882..eac48e00 100644 --- a/backend/CMlexer.mll +++ b/backend/CMlexer.mll @@ -21,10 +21,11 @@ exception Error of string let blank = [' ' '\009' '\012' '\010' '\013'] let floatlit = - ['0'-'9'] ['0'-'9' '_']* + ("-"? (['0'-'9'] ['0'-'9' '_']* ('.' ['0'-'9' '_']* )? - (['e' 'E'] ['+' '-']? ['0'-'9'] ['0'-'9' '_']*)? + (['e' 'E'] ['+' '-']? ['0'-'9'] ['0'-'9' '_']*)? )) | "inf" | "nan" let ident = ['A'-'Z' 'a'-'z' '_'] ['A'-'Z' 'a'-'z' '_' '$' '0'-'9']* +let qident = '\'' [ ^ '\'' ]+ '\'' let temp = "$" ['1'-'9'] ['0'-'9']* let intlit = "-"? ( ['0'-'9']+ | "0x" ['0'-'9' 'a'-'f' 'A'-'F']+ | "0o" ['0'-'7']+ | "0b" ['0'-'1']+ ) @@ -40,6 +41,7 @@ rule token = parse | "!=f" { BANGEQUALF } | "!=u" { BANGEQUALU } | "|" { BAR } + | "builtin" { BUILTIN } | "^" { CARET } | "case" { CASE } | ":" { COLON } @@ -124,8 +126,10 @@ rule token = parse | intlit { INTLIT(Int32.of_string(Lexing.lexeme lexbuf)) } | floatlit { FLOATLIT(float_of_string(Lexing.lexeme lexbuf)) } | stringlit { let s = Lexing.lexeme lexbuf in - STRINGLIT(intern_string(String.sub s 1 (String.length s - 2))) } - | ident | temp { IDENT(intern_string(Lexing.lexeme lexbuf)) } + STRINGLIT(String.sub s 1 (String.length s - 2)) } + | ident | temp { IDENT(Lexing.lexeme lexbuf) } + | qident { let s = Lexing.lexeme lexbuf in + IDENT(String.sub s 1 (String.length s - 2)) } | eof { EOF } | _ { raise(Error("illegal character `" ^ Char.escaped (Lexing.lexeme_char lexbuf 0) ^ "'")) } |