aboutsummaryrefslogtreecommitdiffstats
path: root/test/littlesemantics/little_lex.mll
diff options
context:
space:
mode:
authorlrg <lrg@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2006-10-20 10:38:22 +0000
committerlrg <lrg@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2006-10-20 10:38:22 +0000
commitf0198ebf9430d286ce7c9a53b703e967ce86481c (patch)
treeac069673f4a94e079bf12505c4f0a58baeea34ef /test/littlesemantics/little_lex.mll
parenteb7c8587f462adca878088ef5f610c81734efc70 (diff)
downloadcompcert-kvx-f0198ebf9430d286ce7c9a53b703e967ce86481c.tar.gz
compcert-kvx-f0198ebf9430d286ce7c9a53b703e967ce86481c.zip
interpreter for "little"
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@119 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/littlesemantics/little_lex.mll')
-rw-r--r--test/littlesemantics/little_lex.mll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/littlesemantics/little_lex.mll b/test/littlesemantics/little_lex.mll
new file mode 100644
index 00000000..2d6a85e0
--- /dev/null
+++ b/test/littlesemantics/little_lex.mll
@@ -0,0 +1,23 @@
+{
+open Little_syntax;;
+}
+rule token = parse
+ [ ' ' '\t' '\n' ] {token lexbuf}
+ | "variables" {T_VARIABLES}
+ | "in" {T_IN}
+ | "end" {T_END}
+ | "while" {T_WHILE}
+ | "do" {T_DO}
+ | "done" {T_DONE}
+ | ">" {T_GT}
+ | ":=" {T_ASSIGN}
+ | "+" {T_PLUS}
+ | ";" {T_SCOLUMN}
+ | "(" {T_OPEN}
+ | ")" {T_CLOSE}
+ | "{" {T_OPEN_B}
+ | "}" {T_CLOSE_B}
+ | "skip" {T_SKIP}
+ | "-"?['0'-'9']+ {NUM(int_of_string (Lexing.lexeme lexbuf))}
+ | ['a'-'z''A'-'Z']['a'-'z' 'A'-'Z' '0'-'9' '_']*
+ {ID(Lexing.lexeme lexbuf)}