Skip to content

Converting an indentation-sensitive language into a parse tree #102

Answered by ColinH
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

I just added an (improved over yesterday's version) example for how one could handle a Python-style indentation aware grammar in src/example/pegtl/indent_aware.cpp. For now the code is not particularly elegant, but it does seem to work for the very simplified language that it is intended to recognise, including the check for whether an else has a matching preceding if.

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by d-frey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #102 on December 09, 2020 10:10.