acess the d parser and compiler from the source code
kellywilson at nowhere.com
kellywilson at nowhere.com
Wed Mar 1 11:58:52 PST 2006
In article <du4kni$165u$1 at digitaldaemon.com>, BCS says...
>
>For one thing there would be some value in having more than one compiler (as of
>now AFAIK ther is only one lexer/parcer in existance).
>
Hey there BCS,
If you mean a semantic checking parser, then I also believe there is only one in
existence, but if you just need a parse tree then I have a implementation that
can lex and parse almost all of the D language (two obscure cases won't parse
right now...but otherwise I can parse Phobos and Mango and produce a parse
tree). I use the Elkhound parser generator, which produces C++ output for the
resulting GLR parser.
The parse tree won't be as clean as dmd right now, since I have unresolved
ambiguities in my grammar. When I say unresolved, I mean that there are
ambiguities that could probably be removed, I just haven't gotten to all of them
yet. There will probably always be a couple ambiguities due to the nature of D,
though Manfred Nowak has said in the past that he produced a context free
grammar for D? I haven't seen an actual working context free grammar though, as
he never released it.
I am willing to release my small project (as I have to Ivan Senji) if you or
Dennis would like to use it for some research, as far as your "parsing feature"
goes. Please email me a the University of Calgary (google for "kelly wilson
computer science" and I am the first listing) if you want. I am still working on
building a meaningful AST and then doing the semantic checking, then I will be
more willing to publicly release the project.
Thanks,
Kelly Wilson
P.S. I also believe that having more than one D compiler (two actually since gdc
is a fully functional compiler, but it USES the dmd frontend) is important. Why
are there more than 10 or 20 C++ compilers? Different companies/people produce
different implementations with different "features" and optimizations. Thus,
certain people prefer certain compilers for their architecture. Just my two bits
on the multiple compiler issue...and something to justify my efforts, I guess ;)
>In article <du3vnq$6j8$1 at digitaldaemon.com>, dennis luehring says...
>>
>>what about extending the std.compiler module
>>
>>with an parse(char[] buffer/filename) feature
>>why do we need extra parser projects - can't we use the dmd one
>>internaly?
>>
>>import std.compiler;
>>token_tree = parse("test.d"); ...
>>
>>and maybe an internal compile() feature (like java have)
>>
>>ciao dennis lühring
>>
>>
>
>
More information about the Digitalmars-d
mailing list