Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

grammar parsers

Name: Anonymous 2010-11-30 17:46

I want to made a simple programming language, what should I use for parsing:

1. lex + yacc
2. lemon
3. parsec
4. other (what?)

Name: Anonymous 2010-12-01 20:21

>>14
LOL. I dont have any grammar. To parse my DSL I use simple operator folding. This way I can have full power of Lisp, without sacrificing syntatic macros and reader macros.

Here is an example of simple macro, that implements "dotimes" like functionality

m:times head @body ->
  $@(do c:head.{_=>gensym; #(`:` $c $n)=>c}
        n:head.{x=>x     ; #(`:` $c $n)=>n}
        #(&e:$n {$c => if $c!=&e do $body rec,$c+1} 0))

// Usage: times i:10 say i

With traditional parsers this wouldn't be possible.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List