Skip to content

Implement indentation-sensitive grammar #37

Description

@ketsuban

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.

Activity

  1. alex commented on Nov 12, 2014

    @alex
    Owner

    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?

  2. ketsuban commented on Nov 12, 2014

    @ketsuban
    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.

  3. alex commented on Nov 12, 2014

    @alex
    Owner

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

  4. amcgregor commented on Dec 4, 2014

    @amcgregor

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

  5. prologic commented on Dec 2, 2015

    @prologic

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions