Commit daf0ac66 authored by Eckhart Arnold's avatar Eckhart Arnold
Browse files

documentation extended

parent c59a4104
......@@ -928,6 +928,26 @@ be accessed via the symbol `COMMENT__`.
Lookahead and Lookbehind
------------------------
Lookahead and lookbehind operators are a convenient way to resolve or rather
avoid ambiguities while at the same time keeping the DSL lean. Assume for
example a simple DSL for writing definitions like::
>>> definitions = '''
... dog := carnivorous quadrupel that barks
... human := featherless biped'''
Now, let's try to draw up a grammar for definitions::
>>> def_DSL_first_try = ''' # WARNING: This grammar doesn't work, yet!
... @literalws = right
... definitions = ~ definition { definition } EOF
... definition = definiendum ":=" definiens
... definiendum = word
... definiens = word { word }
... word = /[A-Z]?[a-z]*/
... EOF = /$/ '''
>>> def_parser = create_parser(def_DSL_first_try, "defDSL")
Fail-tolerant Parsing
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment