0

I'm trying to parse this piece of code which is written in my desired grammar and i get syntax error everytime. I've checked my code more than 10 times and i could'nt find a solution. The PARSER and LEXER codes are generated by bison and jflex respectively, since they are long i have to mention a link to my github. Here is my simple piece of code but it gives me the syntax error when i run the program.

program firstProgram
main
{

}

Thanks for helping me with this question.

hexpheus
  • 741
  • 10
  • 22
  • @rici You're an expert in this field. Could you please help me out with this? – hexpheus Apr 20 '17 at 18:37
  • `statement_list` does not produce the empty string so `{}` is not produced by `block`. (That might be easier to see if you remove all the excess verbiage in your grammar file, as I believe I already suggested.) – rici Apr 20 '17 at 19:53

1 Answers1

1

First of all, You must have installed all the preferences of Bison and Lex. After that you have need 2 files before executing your program. The first file having extension ".l" which you declared the tokens and the second file ".cpp" extension would use that tokes to get a desired output. you can get a clue from my code. Here it is [https://github.com/jotpandher/Flex-Bison-task][1]