More grammar issues

Nolan Darilek nolan_d at bigfoot.com
Mon Jan 3 01:34:31 EST 2000


All right. I've begun translating a sizable subset of the standard
Python grammar into Yacc. I'm building a parse tree with the output,
but I'm again confused. Most rules have clearly-defined outputs. These
near the end confuse me, though:

test: and_test ('or' and_test)* | lambdef
and_test: not_test ('and' not_test)*
...

To simplify matters, I've chosen not to implement certain definitions
in my first prototype for simplicity, so for the above example I'm
eliminating lambdef: once I get a working parser and compiler then
I'll begin implementing the language features which I've left
unwritten at the moment.

I'm confused about what types of expressions might fit these
definitions, and how one would go about Yacc-ifying them. It was
easier for me to handle most other definitions since I could visualize
what they might look like, but these have me stumped. :) Thanks in
advance for any help.




More information about the Python-list mailing list