I am new to python, and I am working on a small project writing
a (subset) python compiler from scratch.
During this project, I happen to come across a discrepancy between
the python ref. manual and the interpreter itself.
I apologize if this case has been resolved previously.
According to the Python Reference Manual (Release 1.0.2), the
definition for String conversion is:
string_conversion: "`" condition_list "`" (page 23)
and
condition_list: condition ("," condition)* [","] (page 29)
According to this grammar, the following expression should be valid:
a = `1, 2,`
However, the python interpreter does not seem to like the trailing comma
inside the string conversion. Here is the log:
-------------------------------
Python 1.0.2 (Jan 17 1995)
Copyright 1991-1994 Stichting Mathematisch Centrum, Amsterdam
>>> a = `1,2,`
File "<stdin>", line 1
a = `1,2,`
^
SyntaxError: invalid syntax
>>>
-------------------------------
Using bison (LALR(1)), I get a persistent shift/reduce conflict when
implementing the string conv. However, I was able to eliminate the conflict,
if I don't allow trailing comma in the string conv.
So I wonder if this is related to the above behaviour of python.
Any comments are greatly appreciated.
/antony