diff options
author | Mike Buland <eichlan@xagasoft.com> | 2010-10-18 04:38:19 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2010-10-18 04:38:19 +0000 |
commit | 78463c30031a478936b21168a6fc93ae6eeaaeb9 (patch) | |
tree | 2216344a91f23088dcb4cf93492802c75577fad1 /bnftest.2 | |
parent | 00ecd458ced768b3b8752cdd421a22244b7adc01 (diff) | |
download | libbu++-78463c30031a478936b21168a6fc93ae6eeaaeb9.tar.gz libbu++-78463c30031a478936b21168a6fc93ae6eeaaeb9.tar.bz2 libbu++-78463c30031a478936b21168a6fc93ae6eeaaeb9.tar.xz libbu++-78463c30031a478936b21168a6fc93ae6eeaaeb9.zip |
Several of these new files will go away, but I didn't want to lose them for now.
The parser works! The parser compiler works! It makes parsers!
Now we just have to implement post processing, token lookup tables, and storage.
Diffstat (limited to 'bnftest.2')
-rw-r--r-- | bnftest.2 | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bnftest.2 b/bnftest.2 new file mode 100644 index 0000000..229943b --- /dev/null +++ b/bnftest.2 | |||
@@ -0,0 +1,24 @@ | |||
1 | tokens = tokPlus tokMinus tokMult tokDivide tokOpenParen tokCloseParen | ||
2 | tokEquals tokNumber; | ||
3 | |||
4 | input: line input# | ||
5 | | | ||
6 | ; | ||
7 | |||
8 | input#: line input# | ||
9 | | | ||
10 | ; | ||
11 | |||
12 | line: expr tokEquals {print} | ||
13 | ; | ||
14 | |||
15 | expr: tokOpenParen expr tokCloseParen expr# | ||
16 | | [tokNumber] expr# | ||
17 | ; | ||
18 | |||
19 | expr#: tokPlus expr {add} expr# | ||
20 | | tokMinus expr {subtract} expr# | ||
21 | | tokMult expr {multiply} expr# | ||
22 | | tokDivide expr {divide} expr# | ||
23 | | | ||
24 | ; | ||