www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - 'Hello world' of a D parser

reply "B.G." <gbatyan gmx.net> writes:
I took a look at the source code of the dmd front-end and was unable to 
find sort of an 'entry point' into it. The parse method somewhere 
expected a lot of 'prerequisites', so I just can't figure out where to 
start from.

The readme file states that the code is not ready for compilation or 
something like that, and I wonder what would it take to make a 
hello-world program out of it.

What I mean here is the minimal compilable program based on the soruce 
code of the DMD front end (off course as non-intrusive as possible in 
respect to the original DMD code). All it needs to do is parsing a given 
D file, check it for syntactic and semantic errors and either get the 
errors in a structured form for custom processing, or get the parsed 
tree and any information acquired for further processing. That's it.

Any suggestions are likely to save me a lot of time spent on 
reverse-engineering and would be very much appreciated.

Regards!
May 11 2005
next sibling parent "Joey Peters" <squirrel nidhogg.com> writes:
Ben Hinkle made a front end starters kit. I think if you search for it on 
the announce group you'll find it somewhere.

"B.G." <gbatyan gmx.net> schreef in bericht 
news:d5t1ip$10o1$1 digitaldaemon.com...
I took a look at the source code of the dmd front-end and was unable to 
find sort of an 'entry point' into it. The parse method somewhere expected 
a lot of 'prerequisites', so I just can't figure out where to start from.

 The readme file states that the code is not ready for compilation or 
 something like that, and I wonder what would it take to make a hello-world 
 program out of it.

 What I mean here is the minimal compilable program based on the soruce 
 code of the DMD front end (off course as non-intrusive as possible in 
 respect to the original DMD code). All it needs to do is parsing a given D 
 file, check it for syntactic and semantic errors and either get the errors 
 in a structured form for custom processing, or get the parsed tree and any 
 information acquired for further processing. That's it.

 Any suggestions are likely to save me a lot of time spent on 
 reverse-engineering and would be very much appreciated.

 Regards! 

May 11 2005
prev sibling parent reply =?ISO-8859-1?Q?Val=E9ry?= <valery freesurf.fr> writes:
B.G. a écrit :
 What I mean here is the minimal compilable program based on the soruce 
 code of the DMD front end (off course as non-intrusive as possible in 
 respect to the original DMD code). All it needs to do is parsing a given 
 D file, check it for syntactic and semantic errors and either get the 
 errors in a structured form for custom processing, or get the parsed 
 tree and any information acquired for further processing. That's it.

Have a look at Ben's DMDFE : http://home.comcast.net/~benhinkle/dmdfe/
May 11 2005
next sibling parent reply pragma <pragma_member pathlink.com> writes:
In article <d5t312$11q1$1 digitaldaemon.com>, =?ISO-8859-1?Q?Val=E9ry?= says...
B.G. a écrit :
 What I mean here is the minimal compilable program based on the soruce 
 code of the DMD front end (off course as non-intrusive as possible in 
 respect to the original DMD code). All it needs to do is parsing a given 
 D file, check it for syntactic and semantic errors and either get the 
 errors in a structured form for custom processing, or get the parsed 
 tree and any information acquired for further processing. That's it.

Have a look at Ben's DMDFE : http://home.comcast.net/~benhinkle/dmdfe/

Take it from me, it's a great starting point. I already have a rendition based on this that emits XML files (suitable for documentation) based on D code. - EricAnderton at yahoo
May 11 2005
next sibling parent "Charlie" <charles jwavro.com> writes:
 Take it from me, it's a great starting point.

Seconded, its very nice.
  I already have a rendition based on this that emits XML files

Coolness, maybe it'll blossom into a XML -> MSIL :) ? Charlie "pragma" <pragma_member pathlink.com> wrote in message news:d5tba3$182o$1 digitaldaemon.com...
 In article <d5t312$11q1$1 digitaldaemon.com>, =?ISO-8859-1?Q?Val=E9ry?=

B.G. a écrit :
 What I mean here is the minimal compilable program based on the soruce
 code of the DMD front end (off course as non-intrusive as possible in
 respect to the original DMD code). All it needs to do is parsing a



 D file, check it for syntactic and semantic errors and either get the
 errors in a structured form for custom processing, or get the parsed
 tree and any information acquired for further processing. That's it.

Have a look at Ben's DMDFE : http://home.comcast.net/~benhinkle/dmdfe/

Take it from me, it's a great starting point. I already have a rendition

 on this that emits XML files (suitable for documentation) based on D code.

 - EricAnderton at yahoo

May 11 2005
prev sibling parent reply "B.G." <gbatyan gmx.net> writes:
pragma wrote:
 In article <d5t312$11q1$1 digitaldaemon.com>, =?ISO-8859-1?Q?Val=E9ry?= says...
 
B.G. a écrit :

What I mean here is the minimal compilable program based on the soruce 
code of the DMD front end (off course as non-intrusive as possible in 
respect to the original DMD code). All it needs to do is parsing a given 
D file, check it for syntactic and semantic errors and either get the 
errors in a structured form for custom processing, or get the parsed 
tree and any information acquired for further processing. That's it.

Have a look at Ben's DMDFE : http://home.comcast.net/~benhinkle/dmdfe/

Take it from me, it's a great starting point. I already have a rendition based on this that emits XML files (suitable for documentation) based on D code.

Plain dmdfe still appears to be rather obscure, although it's very cool. Any examples would be appreciated a lot, can I take a look at your code? Thanks!
 
 - EricAnderton at yahoo

May 13 2005
parent pragma <pragma_member pathlink.com> writes:
In article <d62tvl$2nio$2 digitaldaemon.com>, B.G. says...
pragma wrote:
 In article <d5t312$11q1$1 digitaldaemon.com>, =?ISO-8859-1?Q?Val=E9ry?= says...
 
B.G. a écrit :

What I mean here is the minimal compilable program based on the soruce 
code of the DMD front end (off course as non-intrusive as possible in 
respect to the original DMD code). All it needs to do is parsing a given 
D file, check it for syntactic and semantic errors and either get the 
errors in a structured form for custom processing, or get the parsed 
tree and any information acquired for further processing. That's it.

Have a look at Ben's DMDFE : http://home.comcast.net/~benhinkle/dmdfe/

Take it from me, it's a great starting point. I already have a rendition based on this that emits XML files (suitable for documentation) based on D code.

Plain dmdfe still appears to be rather obscure, although it's very cool. Any examples would be appreciated a lot, can I take a look at your code?

Sure! Check out "Dexter": http://svn.dsource.org/projects/dsp/trunk/dexter/ (sorry, no zip archive right now. Examples are the .d and .xml files in the root directory) Most of the work is in /stubs. I *did* have to do some small modifications to bits and pieces of the codebase (most of which are in lexer.c and parser.c). A diff of this and the original dmdfe should tell all. - EricAnderton at yahoo
May 13 2005
prev sibling parent reply "B.G." <gbatyan gmx.net> writes:
Valéry wrote:
 B.G. a écrit :
 
 What I mean here is the minimal compilable program based on the soruce 
 code of the DMD front end (off course as non-intrusive as possible in 
 respect to the original DMD code). All it needs to do is parsing a 
 given D file, check it for syntactic and semantic errors and either 
 get the errors in a structured form for custom processing, or get the 
 parsed tree and any information acquired for further processing. 
 That's it.

Have a look at Ben's DMDFE : http://home.comcast.net/~benhinkle/dmdfe/

Thank you very much...
May 13 2005
parent "Ben Hinkle" <bhinkle mathworks.com> writes:
"B.G." <gbatyan gmx.net> wrote in message 
news:d62tr2$2nio$1 digitaldaemon.com...
 Valéry wrote:
 B.G. a écrit :

 What I mean here is the minimal compilable program based on the soruce 
 code of the DMD front end (off course as non-intrusive as possible in 
 respect to the original DMD code). All it needs to do is parsing a given 
 D file, check it for syntactic and semantic errors and either get the 
 errors in a structured form for custom processing, or get the parsed 
 tree and any information acquired for further processing. That's it.

Have a look at Ben's DMDFE : http://home.comcast.net/~benhinkle/dmdfe/

Thank you very much...

no problem. It's 99% Walter's front end and I just added the stubs for the backend and removed some of the front-end code having to do with data segment layouts (so I'm actually kindof curious what capabilities that throws out...).
May 13 2005