working on parser

git-svn-id: svn://anubis/fart/trunk@84 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop committed 2009-02-08 19:42:55 +00:00
1 parent 80004438be
commit ba7190d7d8
2 files changed
+18 -13

No files matched your search

+8 -4
View File
@@ -4,6 +4,7 @@
%}
%%
\+ return PLUS;
- return MINUS;
\* return STAR;
@@ -28,12 +29,15 @@
\< return LESS;
\> return GREATER;
0b[01]+ return BIN_NUMBER;
0x[0-9A-Fa-f]+ return HEX_NUMBER;
0[0-7]* return OCT_NUMBER;
[1-9][0-9]* return DEC_NUMBER;
[0-9]+ return DEC_NUMBER;
[0-9]*\.[0-9]+ return REAL_NUMBER;
camera return CAMERA;
color return COLOR;
position return POSITION;
scene return SCENE;
\n /* ignore newlines */
[ \t\v] /* ignore whitespace */
%%
+10 -9
View File
@@ -46,21 +46,22 @@ int yywrap()
%token LESS;
%token GREATER;
%token BIN_NUMBER;
%token HEX_NUMBER;
%token OCT_NUMBER;
%token DEC_NUMBER;
%token REAL_NUMBER;
%token CAMERA;
%token COLOR;
%token POSITION;
%token SCENE;
%%
program: /* empty */
| number program { printf("Saw a number\n"); }
scene: /* empty */
| scene_spec { printf("Saw a number\n"); }
;
number: BIN_NUMBER
| OCT_NUMBER
| DEC_NUMBER
| HEX_NUMBER
number: DEC_NUMBER
| REAL_NUMBER
;
%%