Let's stop parser Hell

Jonathan M Davis jmdavisProg at gmx.com
Mon Jul 9 00:28:44 PDT 2012


On Monday, July 09, 2012 09:16:41 Jacob Carlborg wrote:
> On 2012-07-09 08:39, Jonathan M Davis wrote:
> > lambdas are a bit older than that IIRC, and I don't think that UFCS
> > actually affects the lexer or parser. Yes, changes are still made, but
> > they're increasingly rare, and most of the stuff being changed is on the
> > semantic level (most of which is bug fixes). So, out of all of the parts
> > of the compiler to duplicate, those are the least likely to have to have
> > major changes made to them later (especially the lexer).
> 
> I'm pretty sure UFCS affects lexing or parsing. How else would this be
> legal:
> 
> 4.foo();

That definitely wouldn't affect lexing, because it doesn't affect the tokens at 
all. Whether it affects the parser would depend on the grammar. There's a good 
chance it would affect parsing, but it might not. It depends on how numeric 
literals are treated. In most cases though, UFCS definitely wouldn't affect 
parsing at all, because it's purely a matter of symbol resolution, so if 
changes had to be made to the parser, they would almost certainly have been 
minimal.

Yes, some changes are still being made to the parser, but since the language 
is mostly frozen, almost all of the changes have gone into bug fixes, which are 
generally semantic issues and don't affect lexing or parsing at all. So, while 
there would still be some maintenance issues in keeping a separate lexer and 
parser in line with dmd, I really don't think that it would take much at this 
point. Most of the work would be in getting them to match dmd when they're 
first written.

- Jonathan M Davis


More information about the Digitalmars-d mailing list