dmd support for IDEs and the D tool chain

Nick Sabalausky a at a.a
Sat Oct 17 03:09:10 PDT 2009


"Ellery Newcomer" <ellery-newcomer at utulsa.edu> wrote in message 
news:hbaom1$138v$1 at digitalmars.com...
>
> But what I'm wondering about LALR is will it have to back up if it
> chooses wrong, or can it sail on through in one parse attempt. I bet it
> can.
>
> And how about actual ambiguity? How well does GOLD handle that?

I already answered regarding the parsing stage, but I should point out that 
the lexing can still backtrack (I don't know if that's obvious or not). For 
instance, if you have the terminals:

FooKeyword = 'foo'
StuffKeyword = 'fooAAAB'

and input string:

fooAAAC

Then the lexer will get to the A's, try to match StuffKeyword, then get to 
the C, realize StuffKeyword doesn't match after all, so it'll then accept 
the FooKeyword, and continue on again from the first A.

That's probably obvious to language and regex experts, but I actually 
learned that by accident. Someone found a bug in my Goldie GOLD engine when 
using their grammar, and I tracked it down to that kind of scenario and 
realized I was supposed to backtrack, if possible, upon a lex error instead 
of just noting the error and moving on. A better foundation in the theory 
probably would have helped me with that :)

Anyway, I find this stuff neat :) 





More information about the Digitalmars-d mailing list