Compiling DMD parser?
Markus Koskimies
markus at reaaliaika.net
Sun Jul 13 21:07:00 PDT 2008
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 :)
More information about the Digitalmars-d
mailing list