Ari's parsing module:
The core of ari's input: this module allows for the EBNF/pyBNF grammars to be specified, so that other grammars can be read in by ari. Other grammars are then converted to this set of parser-functions.
Parser structure [tokens log] -> [{tree}, [remaining tokens log]] If the parser is unsuccessful, then {tree} will actually be nil, signifying error. The log argument is a dictionary, usually with the keys :all and :head defined as a subdictionary and key-list respectively.
Notes:
Parse technique: Given multiple parsers: While tokens are available for input.. For each available parser, try its first element If this matches, keep the parser in the group of possible parsers If it does not match, remove the parser from the current possible set If there are no parsers left, throw an error.
TODO: Once there is no input left, create a parse tree with the longest parser. If two syntax elements are ambiguous, throw an error.
Ari's parsing module: The core of ari's input: this module allows for the EBNF/pyBNF grammars to be specified, so that other grammars can be read in by ari. Other grammars are then converted to this set of parser-functions. Parser structure [tokens log] -> [{tree}, [remaining tokens log]] If the parser is unsuccessful, then {tree} will actually be nil, signifying error. The log argument is a dictionary, usually with the keys :all and :head defined as a subdictionary and key-list respectively. Notes: Parse technique: Given multiple parsers: While tokens are available for input.. For each available parser, try its first element If this matches, keep the parser in the group of possible parsers If it does not match, remove the parser from the current possible set If there are no parsers left, throw an error. TODO: Once there is no input left, create a parse tree with the longest parser. If two syntax elements are ambiguous, throw an error.
(conseq given-parsers)
Parse a list of given parsers, one after another. If one parser fails, this entire parser fails.
Parse a list of given parsers, one after another. If one parser fails, this entire parser fails.
(conseq-merge given-parsers)
Same functionality as conseq (Parse given parsers in order, failing if any of them fail). The output tree generated by conseq-merge will turn the list of values into a tree, instead. This assumes that parser list provides dictionary list-elements with unique keys. (Which is usually the case)
Same functionality as conseq (Parse given parsers in order, failing if any of them fail). The output tree generated by conseq-merge will turn the list of values into a tree, instead. This assumes that parser list provides dictionary list-elements with unique keys. (Which is usually the case)
(create-parser ident parser)
Create an unnamed parser that tags its resulting tree with the keyword ident
Create an unnamed parser that tags its resulting tree with the keyword ident
(defparser ident parser)
Create an named parser (named $ident) that tags its resulting tree with the keyword $ident
Create an named parser (named $ident) that tags its resulting tree with the keyword $ident
(discard parser)
Require a parser to pass, but intentionally discard its result. This is useful for whitespace parsing and similar
Require a parser to pass, but intentionally discard its result. This is useful for whitespace parsing and similar
(from parsers)
Parse any parser from a list. Currently, if the first parser succeeds, stops parsing.
Parse any parser from a list. Currently, if the first parser succeeds, stops parsing.
(from-except parsers out-parsers)
Apply the from function to a list of parsers, excluding others
Apply the from function to a list of parsers, excluding others
(many given-parser)
Parse a single parser as many times as possible, doesn't fail.
Parse a single parser as many times as possible, doesn't fail.
(many1 given-parser)
Parse a single parser at least once.
Parse a single parser at least once.
(retrieve k ptree-atom)
Retrieve another parser by name from an atomic dictionary
Retrieve another parser by name from an atomic dictionary
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close