Parser compiles from .y and .lex files

This commit is contained in:
Partho Bhattacharya
2025-02-26 15:57:08 -05:00
parent 046ccf194b
commit 3ce8cbae59
4 changed files with 8 additions and 2102 deletions

View File

@ -5,8 +5,10 @@
%{
#include <stdio.h>
#include "symbol_table.c"
extern int yylex(void);
void yyerror(const char *err);
%}
/*
%token ID 101
%token T_INTEGER 201
%token T_ADDRESS 202
@ -52,7 +54,7 @@
%token DOT 612
%token RESERVE 613
%token RELEASE 614
%token COMMENT 700
%token COMMENT 700 */
%%
start: /*empty for now*/
@ -67,7 +69,9 @@ start: /*empty for now*/
%%
void yyerror(const char *err) {
fprintf(stderr, "Error: %s\n", err);
}
int main() {
return yyparse();
}

2099
lex.yy.c

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@
%{
#include <stdbool.h>
#include "typedefs.h"
#include "grammar.tab.h"
int line_number = 1, column_number = 1;
#ifndef DEBUG
#define DEBUG 0

BIN
parser Executable file

Binary file not shown.