Open ketsuban opened 9 years ago
I'm definitely conceptually interested in this (I too, like indentation based grammars, and hate the hack in between my lexer and parser). Are you interested in working on implementing this?
I would if I had much of a clue what I was doing. :) I only have a rough grasp of parsers (still in the "fake it" stage) and the specifically mathematical bits tend to leave me behind - I was webcrawling to see if anyone had any more elegant solutions to the problem when I found the paper.
I'm also not really good with the academic papers, most of the code here is transcribed from the upstream ply.
On Wed Nov 12 2014 at 7:13:46 PM Thomas Winwood notifications@github.com wrote:
I would if I had much of a clue what I was doing. :) I only have a rough grasp of parsers (still in the "fake it" stage) and the specifically mathematical bits tend to leave me behind - I was webcrawling to see if anyone had any more elegant solutions to the problem when I found the paper.
— Reply to this email directly or view it on GitHub https://github.com/alex/rply/issues/37#issuecomment-62804829.
I, too, am resorting to some ugly hacking of tokens in order to get my rply-based grammars to recognize indentation as scope changes. More complete support for indentation-sensitive grammar would be an incredibly nice feature to include. (My esolang, unlike Python, doesn't use colons to indicate a scope increase… nor braces. Only tab-based indentation.)
This would be a nicde addition to rply
This paper presents a formalism for expressing indentation-sensitive grammars in GLR and LR(k) parsers which they claim easily generalises to various other parsers including LALR.
Would it be possible to extend the production syntax accepted by ParserGenerator to accept this and DTRT? I'd prefer not to insert a hack between the lexing and parsing stages of my compiler to convert whitespace into INDENT/DEDENT tokens.