updated testing for parser

This commit is contained in:
Partho Bhattacharya
2025-02-27 15:22:02 -05:00
parent 5626a5c371
commit c85540afdf
3 changed files with 2108 additions and 8 deletions

View File

@ -7,6 +7,8 @@
#include "symbol_table.c"
extern int yylex(void);
void yyerror(const char *err);
extern char* yytext;
extern int yychar;
%}
%token ID 101
@ -59,15 +61,9 @@
input: /*empty for now*/
OPTIONAL;
OPTIONAL_OPTIONAL:
OPTIONAL
| OPTIONAL_OPTIONAL OPTIONAL {printf("expansion\n");};
OPTIONAL:
'[' {printf("success");}
|%empty
;
'[' {printf("success");};
// B : '{'{CreateScope(cur,line,column)} E '}'; //Braced Expressions can have braces removed to get regular expressions
// D : '[' l ']'; //Declaration Lists Brackets can be taken out to get a list of Declarations
// E : Maybe_D U; //An expression can start with an optional D followed by an undeclared segment
@ -82,5 +78,9 @@ void yyerror(const char *err) {
fprintf(stderr, "Error: %s\n", err);
}
int main() {
return yyparse();
int a;
while (a = yyparse()){
printf("%d = a: yytext = %s: yychar = %d\n", a, yytext, yychar);
}
return 0;
}

2100
lex.yy.c Normal file

File diff suppressed because it is too large Load Diff

BIN
parser

Binary file not shown.