diff options
Diffstat (limited to 'demos/sample-files/parser-skeleton.c')
-rw-r--r-- | demos/sample-files/parser-skeleton.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/demos/sample-files/parser-skeleton.c b/demos/sample-files/parser-skeleton.c new file mode 100644 index 0000000..facbc1b --- /dev/null +++ b/demos/sample-files/parser-skeleton.c @@ -0,0 +1,30 @@ +#include <stdio.h> +#include <stdlib.h> + +#include "lr-parser.c" +#include "bin/generated.c" + +#include "parts/toklist.h" + +enum symbol { + PLUS = 0, + MINUS, + LPAREN, + RPAREN, + N0, N1, + END_INPUT, + + EP, E, T, N, + SYMBOLS_END, +}; + +static symbol toklist[] = {N0, PLUS, N1, END_INPUT}; +static symbol *tok = toklist; + +symbol toklist_eat() { return *(tok++); } // unsafe +symbol toklist_peek() { return *tok; } // unsafe + +int main(void) +{ + return lr_parser(); +} |