[Python-Dev] Python keywords (was Lockstep iteration (original) (raw)

Guido van Rossum guido@beopen.com
Wed, 09 Aug 2000 23:44:45 -0500


The parser actually recognizes keywords atm.

We could change that so that each keyword is a token. Then you would have something like: keywordallowedname: KEY1 | KEY2 | KEY3 | ... | KEYN | NAME and then tweak funcdef like so: funcdef: DEF keywordallowedname parameters ':' suite I haven't pondered whether or not this would cause the DFA to fall into a degenerate case or not.

This would be a good and simple approach.

Wondering where the metagrammer source file went to,

It may not have existed; I may have handcrafted the metagrammar.c file.

I believe the metagrammar was something like this:

MSTART: RULE* RULE: NAME ':' RHS RHS: ITEM ('|' ITEM)* ITEM: (ATOM ['*' | '?'])+ ATOM: NAME | STRING | '(' RHS ')' | '[' RHS ']'

--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)