From 17c5d87462c7d3262f50b21b60d3e3367cb74cfc Mon Sep 17 00:00:00 2001 From: Oskar Thoren Date: Fri, 22 Nov 2019 15:15:50 +0800 Subject: [PATCH] instaparse hello world --- abnf/hello-abnf/project.clj | 3 ++- abnf/hello-abnf/src/hello_abnf/core.clj | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/abnf/hello-abnf/project.clj b/abnf/hello-abnf/project.clj index 316277c..b528125 100644 --- a/abnf/hello-abnf/project.clj +++ b/abnf/hello-abnf/project.clj @@ -3,5 +3,6 @@ :url "http://example.com/FIXME" :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/"} - :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}) diff --git a/abnf/hello-abnf/src/hello_abnf/core.clj b/abnf/hello-abnf/src/hello_abnf/core.clj index 533db80..ad32ed9 100644 --- a/abnf/hello-abnf/src/hello_abnf/core.clj +++ b/abnf/hello-abnf/src/hello_abnf/core.clj @@ -1,6 +1,16 @@ -(ns hello-abnf.core) +(ns hello-abnf.core + (:require [instaparse.core :as insta])) (defn foo "I don't do a whole lot." [x] (println x "Hello, World!")) + +(def as-and-bs + (insta/parser + "S = AB* + AB = A B + A = 'a'+ + B = 'b'+")) + +(as-and-bs "aaaaabbbaaaabb")