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

Remove duplicate Symbols caused by a Label #33

Commits on Nov 4, 2019

  1. Remove duplicate Symbols caused by a Label

    **The Problem:** In `NormGrammarReader.processSymbol`, a cache is
    maintained for symbols that are already processed. However, this cache
    did not take into account that Symbols with and without a Label should
    be treated as equal (e.g. `tail:Stm` and `Stm`, see
    org.spoofax.jsglr2.integration/src/main/resources/grammars/layout-sensitive.sdf3).
    These labels are only used to reference the symbols from the layout
    constraints, but do not actually contribute to the meaning of a
    production.
    
    **Why is this a problem?** For SLR parse table generation (see metaborg#27), all
    grammar symbols are assumed to be unique. However, because Symbols with
    or without a Label were not treated as equal, the "graph" used to
    calculate the First- and Follow-sets became disconnected. This in turn
    caused some symbols to have empty First-/Follow-sets. The productions
    belonging to these symbols would not get any reduce actions in the parse
    table, because if the Follow-set is empty, no lookahead is allowed.
    
    **Current solution:** When processing symbols in the `NormGrammarReader`,
    any Label constructor is removed from the symbol term.
    
    **Discussion:** I have tried looking around where these labels are used
    (I am assuming layout constraints, but I couldn't find how they are
    processed in NormGrammarReader).
    Depending on their usage, it might be a good idea to apply this filter
    in Stratego already, e.g. in the strategy `module-to-normal-form`.
    @udesou any feedback is appreciated, as always 🙂
    mpsijm committed Nov 4, 2019
    Configuration menu
    Copy the full SHA
    877f2f7 View commit details
    Browse the repository at this point in the history

Commits on Nov 12, 2019

  1. Configuration menu
    Copy the full SHA
    ab39635 View commit details
    Browse the repository at this point in the history