Interpreter for antlr grammars. Slightly slower, but easier to use than the full antlr compilation process.
Interpreter for antlr grammars. Slightly slower, but easier to use than the full antlr compilation process.
(grammar grammar-or-filename)
Loads a Grammar from a string filename, or a string containing a grammar inline. If the string contains newlines, interprets as a grammar string; otherwise as a filename.
Loads a Grammar from a string filename, or a string containing a grammar inline. If the string contains newlines, interprets as a grammar string; otherwise as a filename.
(lexer-interpreter grammar)
Builds a new lexer interpreter around an empty input stream. Used to initialize our parser, which will later reset and re-use this object for speed.
Builds a new lexer interpreter around an empty input stream. Used to initialize our parser, which will later reset and re-use this object for speed.
(load-string-grammar string)
Loads a grammar from a string.
Loads a grammar from a string.
(parse grammar opts input)
Given a Grammar, options, and text to parse (a string, reader, or inputstream), returns a map of the :parser, :tree, and :errors for the input.
Given a Grammar, options, and text to parse (a string, reader, or inputstream), returns a map of the :parser, :tree, and :errors for the input.
(parser filename)
(parser lexer-filename parser-filename)
Construct a new parser.
Construct a new parser.
(parser-interpreter grammar lexer)
Builds a new parser interpreter around a given grammar and lexer.
Builds a new parser interpreter around a given grammar and lexer.
(reset-lexer-interpreter! lexer error-listener input-stream)
Prepares a lexer interpreter for a new run.
Prepares a lexer interpreter for a new run.
(reset-parser-interpreter! parser error-listener token-stream)
Prepares a parser interpreter for a new run.
Prepares a parser interpreter for a new run.
(rule-index grammar rule-name)
Finds the index of the given rule in a grammar. Throws if the rule is not present in the given grammar. Example
(rule-index my-grammar :address)
Finds the index of the given rule in a grammar. Throws if the rule is not present in the given grammar. Example (rule-index my-grammar :address)
(singlethreaded-parser lexer-grammar grammar)
Creates a new single-threaded parser for a grammar.
Creates a new single-threaded parser for a grammar.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close