Writing a parser

Q&A's, tips, howto's
Locked
Xcalibor
Posts: 1
Joined: Thu Feb 11, 2010 6:58 pm

Writing a parser

Post by Xcalibor »

Greetings all,

I have written a quick 'n' dirty Perl parser for the SGF (Smart Game Format) which is used, among others, to record Go (Igo, Baduk, Weiqi) matches.

Now I'd like to try doing something similar in NewLISP, but I don't want to directly translate the Perl one, but instead try to build something idiomatic...

Is there any examples on how to build a parser in NewLISP? some previous art, even if parsing different document formats?

Thanks and laters

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Re: Writing a parser

Post by HPW »

Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: Writing a parser

Post by Lutz »

... and here is a second example: a JSON parser:

http://www.newlisp.org/syntax.cgi?code/json.lsp.txt

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: Writing a parser

Post by cormullion »

... and I suppose Nestor is a parser of sorts

http://unbalanced-parentheses.nfshost.c ... p.txt.html

since it parses newLISP source code. I use it to generate the coloured syntax listings you see. I wrote a bit about it:

http://unbalanced-parentheses.nfshost.c ... estorpart1

Locked