Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement indentation-sensitive grammar #37

Open
ketsuban opened this issue Nov 12, 2014 · 5 comments
Open

Implement indentation-sensitive grammar #37

ketsuban opened this issue Nov 12, 2014 · 5 comments

Comments

@ketsuban
Copy link

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.

@alex
Copy link
Owner

alex commented Nov 12, 2014

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?

@ketsuban
Copy link
Author

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.

@alex
Copy link
Owner

alex commented Nov 12, 2014

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
#37 (comment).

@amcgregor
Copy link

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

@prologic
Copy link

prologic commented Dec 2, 2015

This would be a nicde addition to rply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants