Example of using the look behind operators & and !. More...
Go to the source code of this file.
Namespaces | |
examples.basics.look_ahead | |
Variables | |
string | examples.basics.look_ahead.title |
string | examples.basics.look_ahead.abnf_syntax = 'S = &(A !bb) 1*aa B !cc\n' |
examples.basics.look_ahead.api = Api() | |
examples.basics.look_ahead.grammar = api.generate(abnf_syntax) | |
examples.basics.look_ahead.parser = Parser(grammar) | |
string | examples.basics.look_ahead.input_string = 'aaabbbccc' |
examples.basics.look_ahead.result = parser.parse(utils.string_to_tuple(input_string)) | |
Example of using the look behind operators & and !.
A well-known non-context free language is L ={anbncn | n>0}. It is shown there how to parse this using look ahead operators. See also the brute-force method with UDTs, namely hand written a code snippets to match a language phrase, examples/basics/udts.py.
Definition in file look_ahead.py.