FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Basic usage

 
Post new topic   Reply to topic     Forum Index -> DGrammar
View previous topic :: View next topic  
Author Message
Holger



Joined: 02 Dec 2004
Posts: 1

PostPosted: Thu Dec 02, 2004 8:55 am    Post subject: Basic usage Reply with quote

Hi Sjoerd,

I just managed to build dgrammar from source---well, it wasn't *that* easy Smile

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 Smile

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
View user's profile Send private message
svanleent



Joined: 25 Sep 2004
Posts: 53

PostPosted: Mon Dec 06, 2004 8:08 am    Post subject: Re: Basic usage Reply with quote

Holger wrote:

I just managed to build dgrammar from source---well, it wasn't *that* easy Smile

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 Smile ) 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
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Sat Dec 11, 2004 3:58 pm    Post subject: Reply with quote

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. Smile
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
svanleent



Joined: 25 Sep 2004
Posts: 53

PostPosted: Wed Dec 15, 2004 3:19 pm    Post subject: Reply with quote

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. Smile


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 Smile

Regards,
Sjoerd
_________________
How C++ became ancient
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DGrammar All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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