Looking for champion - std.lang.d.lex

Jacob Carlborg doob at me.com
Fri Oct 22 12:45:18 PDT 2010


On 2010-10-22 17:37, BLS wrote:
> Why not creating a DLL/so based Lexer/Parser based on the existing DMD
> front end.? It could be always up to date. Necessary Steps. functional
> wrappers around C++ classes, Implementing the visitor pattern (AST),
> create std.lex and std.parse..
>
> my 2 cents
>
> On 22/10/2010 00:01, Walter Bright wrote:
>> As we all know, tool support is important for D's success. Making tools
>> easier to build will help with that.
>>
>> To that end, I think we need a lexer for the standard library -
>> std.lang.d.lex. It would be helpful in writing color syntax highlighting
>> filters, pretty printers, repl, doc generators, static analyzers, and
>> even D compilers.
>>
>> It should:
>>
>> 1. support a range interface for its input, and a range interface for
>> its output
>> 2. optionally not generate lexical errors, but just try to recover and
>> continue
>> 3. optionally return comments and ddoc comments as tokens
>> 4. the tokens should be a value type, not a reference type
>> 5. generally follow along with the C++ one so that they can be
>> maintained in tandem
>>
>> It can also serve as the basis for creating a javascript implementation
>> that can be embedded into web pages for syntax highlighting, and
>> eventually an std.lang.d.parse.
>>
>> Anyone want to own this?
>

I think it would be better to create a lexer/parser in D and have it in 
the standard library. Then one could begin the process of porting the 
DMD frontend using this library. Then hopefully the DMD frontend will be 
written in D and use this new library, being one code base and will 
always be up to date.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list