Skip to content
forked from aphyr/clj-antlr

Clojure bindings for the ANTLR 4 parser

Notifications You must be signed in to change notification settings

talesa/clj-antlr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clj-Antlr with ANTLR alternative labels support

Fork of clj-antlr supporting ANTLRv4 alternative labels. At the moment it's just a rather bad patch to the library for my personal purposes, I may try to 'refactor' it and make a pull request later.

Version left as 0.2.5-SNAPSHOT

How to use

Original way is broken, you can now use it as following

(require [clj-antlr.coerce :as coerce]
         [clj-antlr.interpreted :as interpreted])
(defn parse
  [grammar-file input-file]
  (let [input-string (slurp input-file)
        grammar-str (slurp grammar-file)
        grammar (interpreted/grammar grammar-str)
        m (interpreted/parse grammar {} input-string)
        e (coerce/tree->sexpr m)]
    e))
(parse "grammars/Json.g4" "data/test.json")

About

Clojure bindings for the ANTLR 4 parser

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 81.8%
  • Java 11.9%
  • ANTLR 6.3%