I was making this very simple lex program (just an introductory program). But on compiling lex.yy.c, I am getting this error as:
inToPostfix.l:26: error: ‘struct stackoperand’ has no member named ‘top’
inToPostfix.l:32: error: ‘struct stackoperator’ has no member named ‘top’....
I could not make any reason for this error as I already have defined top in the specified structure.
Can you see any reason for it?
Code is posted at http://pastebin.com/d5f059c1d
Move line 3 to line 16.
You also need to remove the initializers from the structure declarations – at least for C (but the C++ compiler didn’t think much of it either).
To:
In the actions, you also need to declare ‘ch’.
You also need to declare your functions – I made them static. This compiles (assuming you have a C99 compiler – the designated initializers won’t work with C89 compilers):