diff options
author | ubq323 <ubq323@ubq323.website> | 2023-08-01 22:42:24 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2023-08-02 17:46:30 +0100 |
commit | 3a86e3a21394a072b9b59c68861325297f5e066d (patch) | |
tree | 48016b8187cf8e58b3f9346aa8ff88b8e721baf8 /grammar.peg | |
parent | 9e555bc2bf618148929e52ccd0efdb1b752bdcac (diff) |
tersify
Diffstat (limited to 'grammar.peg')
-rw-r--r-- | grammar.peg | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/grammar.peg b/grammar.peg deleted file mode 100644 index 3c75ab9..0000000 --- a/grammar.peg +++ /dev/null @@ -1,41 +0,0 @@ -%source { -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -/* -static const char *dbg_str[] = { "Evaluating rule", "Matched rule", "Abandoning rule" }; -#define PCC_DEBUG(auxil, event, rule, level, pos, buffer, length) \ - fprintf(stderr, "%*s%s %s @%zu [%.*s]\n", (int)((level) * 2), "", dbg_str[event], rule, pos, (int)(length), buffer) - - -*/ -} - - - -%common { -#include "ast.h" - -} - -%value "AstNode" - -expr <- - l:list { $$ = l; } - / n:number { $$ = n; } - / s:symbol { $$ = s; } - -list <- { $$ = astnode_new_list(); } - '(' - ( e:expr { astnode_append(&$$, e); } - )* - ')' _ - -number <- < [0-9]+ > (! ident_char) _ { $$ = astnode_new_num(atoi($1)); } -symbol <- < ident_char+ > _ { $$ = astnode_new_symbol(strdup($1)); } - -ident_char <- [-_a-zA-Z'+*0-9] -_ <- [ \t\n]* - - |