Skip to content

Instantly share code, notes, and snippets.

@roman
Forked from takeoutweight/gist:2339102
Created April 8, 2012 18:48
Show Gist options
  • Save roman/2339136 to your computer and use it in GitHub Desktop.
Save roman/2339136 to your computer and use it in GitHub Desktop.
(ns blah
(:use [zetta.parser.seq :only (whitespace number char)]
[zetta.combinators :only (choice around)]
[zetta.core :only (*>, <*)])
(:require [zetta.core :as z]))
(def whitespaces (many whitespace))
; For that you should use parser combinators and the monadic interface!
; if you have conditionals in your parser, this is the way to go
(def id5
(z/do-parser [
_ (char \#)
n number
symb (<|> (char \#) (char \=))]
(if (= symb \#)
[:ref n]
[:def n])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment