summaryrefslogtreecommitdiff
path: root/grammar.peg
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-07-12 02:22:10 +0100
committerubq323 <ubq323@ubq323.website>2023-07-12 02:22:10 +0100
commitf9f7b92fdda17efe2dca455d6f641a424a97b2db (patch)
tree03f8bfa66a7b944fe9f908972b6ab2dde8b5297f /grammar.peg
parentd9eb793ad606fd47d17a17af24b78b46f2180f84 (diff)
more code
Diffstat (limited to 'grammar.peg')
-rw-r--r--grammar.peg17
1 files changed, 2 insertions, 15 deletions
diff --git a/grammar.peg b/grammar.peg
index 12847e5..5d1dad8 100644
--- a/grammar.peg
+++ b/grammar.peg
@@ -7,6 +7,7 @@
%common {
#include "ast.h"
+#include "run.h"
}
%value "AstNode"
@@ -22,24 +23,10 @@ list <- { $$ = astnode_new_list(); }
)*
')' _
-number <- < [0-9]+ > _ (! ident_char) { $$ = astnode_new_num(atoi($1)); }
+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]*
-%%
-int main() {
- pcc_context_t *ctx = pcc_create(NULL);
- AstNode ret;
- memset(&ret, 0, sizeof ret);
- pcc_parse(ctx, &ret);
-
- astnode_disp(&ret);
- putchar('\n');
-
- pcc_destroy(ctx);
- return 0;
-}
-