instaparse hello world

This commit is contained in:
Oskar Thoren 2019-11-22 15:15:50 +08:00
parent e95a998375
commit 17c5d87462
No known key found for this signature in database
GPG Key ID: B2ECCFD3BC2EF77E
2 changed files with 13 additions and 2 deletions

View File

@ -3,5 +3,6 @@
:url "http://example.com/FIXME" :url "http://example.com/FIXME"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"} :url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[org.clojure/clojure "1.10.0"]] :dependencies [[org.clojure/clojure "1.10.0"]
[instaparse "1.4.10"]]
:repl-options {:init-ns hello-abnf.core}) :repl-options {:init-ns hello-abnf.core})

View File

@ -1,6 +1,16 @@
(ns hello-abnf.core) (ns hello-abnf.core
(:require [instaparse.core :as insta]))
(defn foo (defn foo
"I don't do a whole lot." "I don't do a whole lot."
[x] [x]
(println x "Hello, World!")) (println x "Hello, World!"))
(def as-and-bs
(insta/parser
"S = AB*
AB = A B
A = 'a'+
B = 'b'+"))
(as-and-bs "aaaaabbbaaaabb")