[commit: ghc] master: 4 reduce/reduce parser conflicts resolved (697079f)

git at git.haskell.org git at git.haskell.org
Mon Aug 3 13:36:40 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/697079f118197931e7a8c0768e99bf60be4150fd/ghc

>---------------------------------------------------------------

commit 697079f118197931e7a8c0768e99bf60be4150fd
Author: Ulya Trofimovich <skvadrik at gmail.com>
Date:   Mon Aug 3 14:56:16 2015 +0200

    4 reduce/reduce parser conflicts resolved
    
    As GHC documentation (section 7.4.4, Type operators) says:
    > "There is now some potential ambiguity in import and export lists;
    for example if you write import M( (+) ) do you mean the function (+)
    or the type constructor (+)? The default is the former, but with
    -XExplicitNamespaces (which is implied by -XExplicitTypeOperators) GHC
    allows you to specify the latter by preceding it with the keyword type"
    
    Turns out this ambiguity causes 4 of 6 reduce/reduce conflicts in GHC
    parser.  All 4 conflicts arise from a single production:
    
        qcname
            :  qvar
            |  oqtycon
    
    Recursive inlining of 'qvar' and 'oqtycon' helps reveal the faulty
    productions:
    
        qcname
            :
        ...
            | '(' QVARSYM ')'
            | '(' VARSYM ')'
            | '(' '*'    ')'
            | '(' '-'    ')'
    
    These productions can either be parsed as variable or type constructor,
    but variable constuctor is always preferred. My patch removes ambiguity
    while preserving the existing behaviour:
    
      - all unambigous productions are left as-is
      - ambigous productions for variable constuctors are left
      - ambigous productions for type constructors are removed (there's no
        way they could be triggered)
    
    Updated comment.
    
    Test Plan: Tested with 'make fasttest'
    
    Reviewers: austin, simonpj, trofi, bgamari, simonmar
    
    Reviewed By: trofi, bgamari, simonmar
    
    Subscribers: thomie, mpickering
    
    Projects: #ghc
    
    Differential Revision: https://phabricator.haskell.org/D1111


>---------------------------------------------------------------

697079f118197931e7a8c0768e99bf60be4150fd
 compiler/parser/Parser.y | 253 +++++++++++++++++++----------------------------
 1 file changed, 99 insertions(+), 154 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 697079f118197931e7a8c0768e99bf60be4150fd


More information about the ghc-commits mailing list