On Wed, 2006-10-04 at 19:02 -0700, Erick Tryzelaar wrote: > Speaking of python, think we can support the "[1,2,3,]" python comma > style? I use that all the time in my python code.
I don't think so (though I haven't tried). This style is horrendously difficult to parse. In Vyper, my Python implementation, I used Ocamlyacc parser plus a pre-processor to 'munge' the non-LALR1 constructions and handle INDENT/DEDENT etc. The trailing comma was easily the worst problem: I can't recall exactly but it took approximately 13 prepasses to condition Python for LALR1 parsing .. basically the prepasses had to throw the trailing comma out. The current grammar is: tuple: | or_condition tuple_suffix | or_condition tuple_suffix: | COMMA or_condition tuple_suffix | COMMA or_condition You'd want to add: | or_condition tuple_suffix COMMA but then it is ambiguous whether to reduce tuple, or shift and try to parse a tuple_suffix. LALR1 has only 1 token lookahead, it has to make every decision based on the current token. -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Felix-language mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/felix-language
