I am writing a translator/interpreter for the Pascal lang in C++/Bison.

First of all, I don't know how to differentiate when an identifier is
acting as a variable in an assignment, or it is just a func call with
no params. What I was doing up to now was to recognize something like
this ...

And then I did error checking after parsing (since this allows for
things like foo [ bar ](1) and foo.bar(1)).

But recently I came up with another idea: instead of returning an ID
for any identifier, I looked up the identifier in the lexer, and
returned ID_UNKNOWN, ID_FUNCTION, etc ... This allowed me to have much
less error checking and no conflicts in the bison grammar.

I would appreciate any opinions as to which one is better.

Second, I am considering the option of emitting P-code for the
programs ... Does anybody know where can I get info on anything
related to this ?

Thanks a lot,
Nicolás
[I've seen compilers that work either way. I prefer the lexer lookup
since it permits earlier error reporting. -John]