From 53865aad225ffbe5cf3c42736e5a2095092f9fff Mon Sep 17 00:00:00 2001 From: JSDurand Date: Fri, 21 Jan 2022 21:53:50 +0800 Subject: temporary save point Just to save some work. --- src/reader.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/reader.c') diff --git a/src/reader.c b/src/reader.c index d715726..7676d2d 100644 --- a/src/reader.c +++ b/src/reader.c @@ -68,7 +68,8 @@ read_tnt_string(const str * const restrict s, NUM start, NUM end, free(string); string = NULL; - *(tnts+tnt_count++) = (TNT) { 1, { .nt = nt_index } }; + *(tnts+tnt_count++) = (TNT) { NONTERMINAL, + { .nt = nt_index } }; readingp = 0; } @@ -112,7 +113,8 @@ read_tnt_string(const str * const restrict s, NUM start, NUM end, if (local_exit) return 1; } - *(tnts+tnt_count++) = (TNT) { 0, { .t = strinfo.value } }; + *(tnts+tnt_count++) = (TNT) { TERMINAL, + { .t = strinfo.value } }; strindex += strinfo.step; } @@ -159,7 +161,8 @@ read_tnt_string(const str * const restrict s, NUM start, NUM end, free(string); string = NULL; - *(tnts+tnt_count++) = (TNT) { 1, { .nt = nt_index } }; + *(tnts+tnt_count++) = (TNT) { NONTERMINAL, + { .nt = nt_index } }; } break; } @@ -177,6 +180,9 @@ print_int(void *p) printf("%d\n", *((int *)p)); } +/* TODO: Rewrite the reader to include the comments and escaping + across multiple lines. Rewrite into a GLL parser by hand. */ + /* Read a grammar from a string in the format of BNF notation. */ Grammar * read_grammar_from_bnf(const str * const restrict s) -- cgit v1.2.3-18-g5258