Looking for champion - std.lang.d.lex

Walter Bright newshound2 at digitalmars.com
Thu Oct 21 23:55:42 PDT 2010


Jonathan M Davis wrote:
> On Thursday 21 October 2010 15:01:21 Walter Bright wrote:
>> 5. generally follow along with the C++ one so that they can be maintained
>> in tandem
> 
> Does this mean that you want a pseudo-port of the C++ front end's lexer to D for 
> this? Or are you looking for just certain pieces of it to be similar?

Yes, but not a straight port. The C++ version has things in it that are 
unnecessary for the D version, like the external string table (should use an 
associative array instead), the support for lookahead can be put in the parser, 
doesn't tokenize comments, etc.

Essentially I'd like the D lexer to be self-contained in one file.

> I haven't looked at the front end code yet, so I don't know how it works there, 
> but I wouldn't expect it to uses ranges, for instance, so I would expect that 
> the basic design would naturally stray a bit from whatever was done in C++ 
> simply by doing things in fairly idiomatic D. And if I do look at the front end 
> to see how that's done, there's the issue of the license. As I understand it, 
> the front end is LGPL, and Phobos is generally Boost, which would mean that I 
> would be looking at LGPL-licensed code when designing Boost-licensed, even 
> though it wouldn't really be copying the code per se since it's a change of 
> language (though if you did the whole front end, obviously the license issue can 
> be waved quite easily).

Since the license is mine, I can change the D version to the Boost license, no 
problem.


> License issues aside, however, I do think that it would make sense for 
> std.lang.d.lex to do things similiarly to the C++ front end, even if there are a 
> number of basic differences.

Yup. The idea is the D version lexes exactly the same grammar as the dmd one. 
The easiest way to ensure that is to do equivalent logic.


More information about the Digitalmars-d mailing list