Version 1.0
Copyright © 2022 Lowell D. Thomas
Python APG
 … an ABNF Parser Generator
Namespaces | Variables
look_ahead.py File Reference

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))
 

Detailed Description

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.

Python APG, Version 1.0, is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.