I am trying to parse an indent based text - like python.
I looked at the python3 grammar (
github) and do not completely understand the code. To get a better feeling for its workings I was planning on experimenting with it (in a separate project).
I do not want to put code into the grammar, so I aim to inject a custom Lexer base class to perform the indenting-logic.
Looking at the Lexer cpp code I am at a loss where and how to implement this logic.
Any tips would be helpful.
Related: I aim to produce a parse tree that has the correct nesting based on these indents. As this is my first real (more-complex) grammar project, I am not sure if this is feasible.
I figured I would do as much as possible in the parser in terms of generating an AST...
Thanks,
Marc