Compiling DMD parser?

davidl davidl at 126.com
Sun Jul 13 21:31:39 PDT 2008


在 Mon, 14 Jul 2008 12:07:00 +0800,Markus Koskimies  
<markus at reaaliaika.net> 写道:

> On Mon, 14 Jul 2008 11:26:13 +0800, davidl wrote:
>
>> actually dparser is not 1.014 anymore. it's somewhat 1.024ish the
>> parsing ability has been improved a lot, it can parse itself, and some
>> ctfes.
>> 700 or so cases from dstress fail.
>
> :o
>
> I fetched the sources (I tried to select the latest ones), and attached
> that DParser to my own code. I copied the set-ups from  
> trunk/d1.0/dparser/
> dmd/main.d, and do parsing and semantic passes 1 to 3 to build the parsed
> tree.
>
> Problems:
>
> - Parser segfaults, if it parses std.stdio
>
> - I'm trying to write a tree walker; I have walk(X) functions for
> different types of elements (Module, FuncDeclaration,
> DeclStatement, ...). But I have hard times to determine the types of
> statements, since Statement class contains only a few "isXXXX()"
> functions. I tried to use typeid(typeof(s)), but it returns - as you may
> guess - always the type that was declared in the function arguments.
>
> ---
> I use DMD1.030, and I have those 1.030 phobos sources.
>
> I'll try to figure out how to extract that statement type information
> from parse tree, and could wait for newer versions of DParser.
>
> At the same time I'll try to get dil compiled; although dil does not
> generate code, it might still be a suitable platform to write a software
> to generate some common warnings (just for my personal use, I'm not
> intended to start to write "dlint"). Unfortunately it means that I need
> to figure out how those DSSS & Tango things work :)

err, i didn't maintain the trunk/d1.0/dparser/dmd/main.d
and surely the d2.0 branch also not maintained at the moment.

use d1.0/test_dparser

It shouldn't segfault. std.stdio has been parsed a lot of times here :)
It's a good start from there I think

-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/



More information about the Digitalmars-d mailing list