From 69903c33fb0167886678a6ae064c80ea276e63cd Mon Sep 17 00:00:00 2001 From: josh Date: Tue, 4 Nov 2008 17:44:41 +0000 Subject: [PATCH] added more tokens, simple assignment rule git-svn-id: svn://anubis/misc/llvm@67 bd8a9e45-a331-0410-811e-c64571078777 --- jlc/jl.lex | 7 +++++++ jlc/jl.y | 14 +++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/jlc/jl.lex b/jlc/jl.lex index 4d9bf83..8ad631f 100644 --- a/jlc/jl.lex +++ b/jlc/jl.lex @@ -19,6 +19,13 @@ - return MINUS; \* return TIMES; \/ return DIVIDE; +% return MOD; + +; return SEMICOLON; +: return COLON; +\. return DOT; +\" return DQUOTE; +\' return SQUOTE; 0b[01]+ return BIN_NUMBER; 0x[0-9A-Fa-f]+ return HEX_NUMBER; diff --git a/jlc/jl.y b/jlc/jl.y index b778fb1..52940b5 100644 --- a/jlc/jl.y +++ b/jlc/jl.y @@ -40,6 +40,13 @@ int main(int argc, char * argv[]) %token MINUS; %token TIMES; %token DIVIDE; +%token MOD; + +%token SEMICOLON; +%token COLON; +%token DOT; +%token DQUOTE; +%token SQUOTE; %token BIN_NUMBER; %token HEX_NUMBER; @@ -54,12 +61,13 @@ int main(int argc, char * argv[]) program: /* empty */ | number program { printf("Saw a number\n"); } + | assignment program { printf("Saw an assignment\n"); } number: BIN_NUMBER | OCT_NUMBER | DEC_NUMBER | HEX_NUMBER - { - printf("Saw a number\n"); - } ; + +assignment: ID ASSIGN number + ;