[PATCH v3 2/2] D: Move classification of symbols from the grammar to the lexer

Iain Buclaw ibuclaw@gdcproject.org
Mon Aug 3 18:18:00 GMT 2015


This patch rewrites the lexer to be just like C++'s, where it will
attempt to classify and reduce any alternating '.' and symbol-like
tokens.

There is a little added complexity as existing D compilers will only
write the full module name to debug.  For instance, given
'package.and.another.foo', the first three parts will return as
unknown/non-existent symbols.   While it would be nice to fix this in
my compiler, there does not seem to be a nice way to chain package and
module names together that is understood by GDB (I think language_go
has a similar problem to this).

However, now I'm happy.  As I can finally begin to start supporting
and implementing exp.property style syntax in the grammar without
running into shift reduce conflicts (starting with .sizeof and .typeof
:-)

Regards
Iain.
---
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dlang-grammar.patch
Type: text/x-patch
Size: 27627 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20150803/714bf05e/attachment.bin>


More information about the Gdb-patches mailing list