diff options
author | kartofen <mladenovnasko0@gmail.com> | 2025-07-09 17:23:04 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2025-07-09 17:23:04 +0300 |
commit | 2c85f2d087b9b2f3922b856beed4e2dd5b0fc126 (patch) | |
tree | 49de0cef8eb32596f2629e3d2855400484fbd8aa | |
parent | e911e95f697b0eb48ed4e68cb2586ffb0dc11341 (diff) |
edit readme
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | demos/sample-files/calc-defs.c | 2 | ||||
-rw-r--r-- | demos/sample-files/calc-skeleton.c | 5 | ||||
-rw-r--r-- | parts/grammar.h | 4 | ||||
-rw-r--r-- | parts/symbol.h | 2 | ||||
-rw-r--r-- | parts/table.h | 2 |
6 files changed, 19 insertions, 3 deletions
@@ -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 <stdio.h> +#include <stddef.h> // 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 <ctype.h> #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 <stddef.h> // size_t + extern struct production { symbol LHS; symbol *RHS; @@ -9,6 +11,8 @@ extern struct production { extern size_t total_productions; +#include <stdio.h> + 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 <stddef.h> // 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 <stddef.h> // size_t + extern struct action { enum action_type { ACTION_NOT_SET = 0, ACTION_SHIFT, |