View previous topic :: View next topic |
Author |
Message |
Holger
Joined: 02 Dec 2004 Posts: 1
|
Posted: Thu Dec 02, 2004 8:55 am Post subject: Basic usage |
|
|
Hi Sjoerd,
I just managed to build dgrammar from source---well, it wasn't *that* easy
Python complained about undefined "Environment"-statements, etc. What went wrong?
Nevertheless, I complied the two files by hand and renamed them untill there were no errors anymore. Everything is fine now
I know that examples will be included in the next milestone, but I would really be interested in how a typical dgrammar-file looks like.
In the D forum you wrote that dgrammar does not use inline code like YACC. So how does it work then?
Holger |
|
Back to top |
|
|
svanleent
Joined: 25 Sep 2004 Posts: 53
|
Posted: Mon Dec 06, 2004 8:08 am Post subject: Re: Basic usage |
|
|
Holger wrote: |
I just managed to build dgrammar from source---well, it wasn't *that* easy
Python complained about undefined "Environment"-statements, etc. What went wrong?
|
You need SConstruct (www.scons.org) to use the SConstruct file. This is a variant on the well-known make.
Holger wrote: |
In the D forum you wrote that dgrammar does not use inline code like YACC. So how does it work then?
|
Anyway, if there where compiler errors (no SConstruct errors ) then please post them, I want to now them.
Also I am still busy solving a Reduce/reduce problem, but I think it should be solvable within this month.
DGrammar indeed doesn't use inline code (in this case D code). Roughly it generates an OO class out of each grammar and you can use these generated classes to evaluate it using normal D code.
This way, the grammar and D code are split apart, and therefor much better to maintain. As opposed to YACC, which has the code inline. Also portability is served better this way, since when DGrammar doesn't work on a platform, it still may produce the right D code for one platform on another platform. _________________ How C++ became ancient |
|
Back to top |
|
|
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Sat Dec 11, 2004 3:58 pm Post subject: |
|
|
Iiiiiinteresting. So does this mean a generated class for each rule (presumably with a common parent) arranged in a tree? Or a single grammar class with data in trees? Or.. what? Would one use delegate hooks to process the elements, or is it passing around of object referances, or... what?
I'm just curious as I'm quite interested in using something like this. _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
svanleent
Joined: 25 Sep 2004 Posts: 53
|
Posted: Wed Dec 15, 2004 3:19 pm Post subject: |
|
|
csauls wrote: | Iiiiiinteresting. So does this mean a generated class for each rule (presumably with a common parent) arranged in a tree? Or a single grammar class with data in trees? Or.. what? Would one use delegate hooks to process the elements, or is it passing around of object referances, or... what?
I'm just curious as I'm quite interested in using something like this. |
Well, currently per grammar a class is generated. Currently it is only object -reference passing. But the method of delegate hooks sure look interesting (I got an idea on paper to implement it like SAX). This also makes it much easier to perform logical calculations in a valid order. This will be added when I fixed the current reduction problem.
I got a solution on paper, but I didn't have any time to implement it, due to the 25th aniversary of my parents
Regards,
Sjoerd _________________ How C++ became ancient |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|