Best practices for parsing files
BCS
ao at pathlink.com
Thu Jan 25 14:24:58 PST 2007
Reply to lurker,
> Hi.
>
> I'm new to D but not to programming. I would like to write a small
> scripting engine using the great D programming language but I'm
> undecided on what techniques should use to parse source files.
>
> Since slices seem to be a central feature of D I was thinking on
> reading the whole file in memory and use slices to build the syntax
> tree.
>
> Does anyone have examples of parsing files using this method?
>
> Any other methods I should consider?
>
> Thanks.
>
Enki would be my choice if you don't mind using a code generator
http://www.dsource.org/projects/ddl/wiki/Enki
If you are feeling adventurous you can try dparse
http://www.dsource.org/projects/scrapple/browser/trunk/dparser/dparse.d
It's not vary mature but it's kind of fun to play with.
(full disclosure: I wrote dparse)
More information about the Digitalmars-d
mailing list