From 2c85f2d087b9b2f3922b856beed4e2dd5b0fc126 Mon Sep 17 00:00:00 2001 From: kartofen Date: Wed, 9 Jul 2025 17:23:04 +0300 Subject: edit readme --- README.md | 7 +++++++ demos/sample-files/calc-defs.c | 2 +- demos/sample-files/calc-skeleton.c | 5 +++-- parts/grammar.h | 4 ++++ parts/symbol.h | 2 ++ parts/table.h | 2 ++ 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f1efbff..5dade64 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,13 @@ techniques and ways to add semanitic meaning. ### TODO +#### NOW: + +- Deal with conflicts (copy lemon for precedence) +- EBNF parser to get the whatever-def.c file + +#### Goals + - Proper LALR generation - LL table generation and parsing - Possibly recursive ascent and recursive descent generation (a bit pointless) diff --git a/demos/sample-files/calc-defs.c b/demos/sample-files/calc-defs.c index de1f705..ba22877 100644 --- a/demos/sample-files/calc-defs.c +++ b/demos/sample-files/calc-defs.c @@ -1,4 +1,4 @@ -#include +#include // size_t #include "parts/symbol.h" enum symbol { diff --git a/demos/sample-files/calc-skeleton.c b/demos/sample-files/calc-skeleton.c index 29f181b..2108999 100644 --- a/demos/sample-files/calc-skeleton.c +++ b/demos/sample-files/calc-skeleton.c @@ -3,9 +3,10 @@ #include #include "lr-parser.c" -#include "bin/a.c" +#include "bin/a.c" // generated -// from calc-defs.c +// these should come from a generated +// header file by the parser generator #include "parts/symbol.h" enum symbol { PLUS = 0, diff --git a/parts/grammar.h b/parts/grammar.h index a02a99e..d1bf176 100644 --- a/parts/grammar.h +++ b/parts/grammar.h @@ -1,6 +1,8 @@ #ifndef GRAMMAR_H #define GRAMMAR_H +#include // size_t + extern struct production { symbol LHS; symbol *RHS; @@ -9,6 +11,8 @@ extern struct production { extern size_t total_productions; +#include + void grammar_print() { for(size_t i = 0; i < total_productions; i++) { diff --git a/parts/symbol.h b/parts/symbol.h index e5e45d3..2190eca 100644 --- a/parts/symbol.h +++ b/parts/symbol.h @@ -1,6 +1,8 @@ #ifndef SYMBOL_H #define SYMBOL_H +#include // size_t + typedef unsigned int symbol; extern size_t total_symbols; extern char **symbol_to_str; diff --git a/parts/table.h b/parts/table.h index fc63488..f3099fe 100644 --- a/parts/table.h +++ b/parts/table.h @@ -1,6 +1,8 @@ #ifndef TABLE_H #define TABLE_H +#include // size_t + extern struct action { enum action_type { ACTION_NOT_SET = 0, ACTION_SHIFT, -- cgit v1.2.3