Hi I am trying to follow the book "Modern Compiler Implementation in C" in the 3 chapter PARSER I am not able execute the parser exercise.
%{
#include <stdio.h>
#include "util.h"
#include "errormsg.h"
int yylex(void); /* function prototype */
void yyerror(char *s)
{
EM_error(EM_tokPos, "%s", s);
}
%}
%union {
int pos;
int ival;
string sval;
}
%token <sval> ID STRING
%token <ival> INT
%token
LET
%start program
%%
program: LET
I run this against the test file which contains
test1.tig
let
I am getting
test1.tig:1.1: syntax error
Parsing failed
Link for the Exercises provided online Chap3
I am not able to find why the error is occuring even for just a word .
- Is the exercise in the parser correct in the link above ?
- Could you help me to run the parser successfully ? I have written rest of the code too.