Why aren't colons optional?

Neil Hodgson nhodgson at bigpond.net.au
Sun Jan 20 17:44:26 EST 2002


[Sorry if this turns up multiple times as my last post did]

Courageous:
> > Doesn't look like it would be ambiguous with slicing
> > AS THE CONTEXTS ARE DIFFERENT.
>
> Written a parser before?

   Yes, although most of my public work has been more at the lexical level.
These include the lexers built into Scintilla (the Python lexer is used in
PythonWin, Komodo, Wing, BlackAdder, Boa, etc.) and the C++ Subset to Java /
C# translator in SinkWorld.

   In this case, I'd (depending on the parser technology used, I like ANTLR)
stick a sliceOrDictionary in the initial parse tree and then decorate it
with an attribute later. As Alex pointed out, the index / literal
distinction has to be recognised now for [7].

   Neil






More information about the Python-list mailing list