summaryrefslogtreecommitdiff
path: root/g.peg
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-08-06 22:20:53 +0100
committerubq323 <ubq323@ubq323.website>2024-08-06 22:20:53 +0100
commita4e8599e8d0fde881cd4e6e3031e5b52550e878e (patch)
tree41f455835a76442eb2442754f5d4fd15c915f721 /g.peg
parente4a7b6c397c430e3aa5f6fec63eeb91236069c27 (diff)
remove ast and peg parser
Diffstat (limited to 'g.peg')
-rw-r--r--g.peg52
1 files changed, 0 insertions, 52 deletions
diff --git a/g.peg b/g.peg
deleted file mode 100644
index 84d907e..0000000
--- a/g.peg
+++ /dev/null
@@ -1,52 +0,0 @@
-%source {
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-#ifdef DO_PARSE_DEBUG
-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)
-#endif
-
-#define PCC_GETCHAR(auxil) fgetc(auxil)
-
-}
-
-
-
-%common {
-#include "ast.h"
-
-}
-
-%value "AstNode"
-%auxil "FILE *"
-
-expr <-
- l:list { $$ = l; }
- / n:number { $$ = n; }
- / i:ident { $$ = i; }
- / t:string { $$ = t; }
- / a:array { $$ = a; }
-
-list <- { $$ = astnode_new_list(); }
- '(' _
- ( e:expr { astnode_append(&$$, e); }
- )*
- ')' _
-array <- { $$ = astnode_new_arr(); }
- '[' _
- ( e:expr { astnode_append(&$$, e); }
- )*
- ']' _
-
-number <- < [0-9]+ > (! ident_char) _ { $$ = astnode_new_num(atoi($1)); }
-ident <- < ident_char+ > _ { $$ = astnode_new_ident($1); }
-string <- '"' < [^"]* > '"' _ { $$ = astnode_new_string($1); }
-
-ident_char <- [-_a-zA-Z'+*/\\%=0-9<>!,]
-_ <- [ \t\n]*
-
-