www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Writing parsers

reply Someone surfing on the net <Someone_member pathlink.com> writes:
I need to write a lexer / parser for a language like SQL and thougth this was
the perfect change to learn D. Any comments, advice or tutorials that you can
recomend.

Thanks.
Sep 17 2004
next sibling parent reply Stephan Wienczny <Stephan Wienczny.de> writes:
Someone surfing on the net wrote:
 I need to write a lexer / parser for a language like SQL and thougth this was
 the perfect change to learn D. Any comments, advice or tutorials that you can
 recomend.
 
 Thanks.
 
 

Stephan
Sep 17 2004
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Stephan Wienczny wrote:
 Someone surfing on the net wrote:
 
 I need to write a lexer / parser for a language like SQL and thougth 
 this was
 the perfect change to learn D. Any comments, advice or tutorials that 
 you can
 recomend.

 Thanks.


How would a D parser in C help with writing a parser for a SQL-like language in D? Lars Ivar Igesund
Sep 18 2004
parent Stephan Wienczny <Stephan Wienczny.de> writes:
Lars Ivar Igesund wrote:
 
 How would a D parser in C help with writing a parser for a SQL-like 
 language in D?
 
 Lars Ivar Igesund

It helps writing parsers in general. IMHO there is no big difference between C and D for Parsers. The concept is still the same. Stephan
Sep 18 2004
prev sibling next sibling parent reply J C Calvarese <jcc7 cox.net> writes:
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Someone surfing on the net wrote:
 I need to write a lexer / parser for a language like SQL and thougth this was
 the perfect change to learn D. Any comments, advice or tutorials that you can
 recomend.
 
 Thanks.

A while back, I converted a program called D2HTML into another program that attempts to produce syntax-highlighted webpages. I haven't spend much time on the SQL analysis part of it, so there's probably a lot of unnecessary code. In case it makes a difference, it was targeted at Microsoft Access-style SQL. Maybe this will help you figure out how to accomplish your goal, so I'm attaching the code and the other files needed to use it. If you're looking for general D tutorials, try: http://www.prowiki.org/wiki4d/wiki.cgi?D__Tutorial -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Sep 18 2004
parent =?ISO-8859-1?Q?Sigbj=F8rn_Lund_Olsen?= <sigbjorn lundolsen.net> writes:
J C Calvarese wrote:

 Microsoft Access-style SQL.

A small digression, being in a suitably bleak mood at the moment: "Microsoft Access-style ___Standard___ Query Language" Cheers, Sigbjørn Lund Olsen
Sep 19 2004
prev sibling next sibling parent Stephen Silber <Stephen_member pathlink.com> writes:
In all honesty, go use a prebuilt solution, and do something less painful to
learn D!

Check out www.antlr.org for a great parser toolkit that already has a SQL
grammar for it.

I need to write a lexer / parser for a language like SQL and thougth this was
the perfect change to learn D. Any comments, advice or tutorials that you can
recomend.

Sep 19 2004
prev sibling parent Ilya Minkov <minkov cs.tum.edu> writes:
Someone surfing on the net schrieb:

 I need to write a lexer / parser for a language like SQL and thougth this was
 the perfect change to learn D. Any comments, advice or tutorials that you can
 recomend.

For a very calm introduction, you may like http://compilers.iecc.com/crenshaw/ It doesn't cover many things, but i liked it. I work somewhat differently for my purposes, but the basic ideas are the same. Don't hesitate to ask me questions, we will work out some solutions. Otherwise, you may want to use some parser generator - i half-way even ported COCO/R to D, but then decided to change the direction and change the C version instead of porting the Java one. If i have time next days, i do that. -eye/photoallergics
Sep 24 2004