[Git][ghc/ghc][wip/pat-builder-tagless] 4 commits: update-autoconf: Initial commit

Vladislav Zavialov gitlab at gitlab.haskell.org
Sat Apr 27 15:09:06 UTC 2019



Vladislav Zavialov pushed to branch wip/pat-builder-tagless at Glasgow Haskell Compiler / GHC


Commits:
faa94d47 by Ben Gamari at 2019-04-25T21:16:21Z
update-autoconf: Initial commit

- - - - -
4811cd39 by Ben Gamari at 2019-04-25T21:16:21Z
Update autoconf scripts

Scripts taken from autoconf a8d79c3130da83c7cacd6fee31b9acc53799c406

- - - - -
0040af59 by Ben Gamari at 2019-04-25T21:16:21Z
gitlab-ci: Reintroduce DWARF-enabled bindists

It seems that this was inadvertently dropped in
1285d6b95fbae7858abbc4722bc2301d7fe40425.

- - - - -
63bee1bc by Vladislav Zavialov at 2019-04-27T15:08:42Z
Pattern/expression ambiguity resolution

This patch removes 'EWildPat', 'EAsPat', 'EViewPat', and 'ELazyPat'
from 'HsExpr' by using the ambiguity resolution system introduced
earlier for the command/expression ambiguity.

Problem: there are places in the grammar where we do not know whether we
are parsing an expression or a pattern, for example:

	do { Con a b <- x } -- 'Con a b' is a pattern
	do { Con a b }      -- 'Con a b' is an expression

Until we encounter binding syntax (<-) we don't know whether to parse
'Con a b' as an expression or a pattern.

The old solution was to parse as HsExpr always, and rejig later:

	checkPattern :: LHsExpr GhcPs -> P (LPat GhcPs)

This meant polluting 'HsExpr' with pattern-related constructors. In
other words, limitations of the parser were affecting the AST, and all
other code (the renamer, the typechecker) had to deal with these extra
constructors.

We fix this abstraction leak by parsing into an overloaded
representation:

	class DisambECP b where ...
	newtype ECP = ECP { runECP_PV :: forall b. DisambECP b => PV (Located b) }

See Note [Ambiguous syntactic categories] for details.

Now the intricacies of parsing have no effect on the hsSyn AST when it
comes to the expression/pattern ambiguity.

- - - - -


10 changed files:

- .gitlab-ci.yml
- compiler/deSugar/DsExpr.hs
- compiler/hieFile/HieAst.hs
- compiler/hsSyn/HsExpr.hs
- compiler/hsSyn/HsExtension.hs
- compiler/parser/Lexer.x
- compiler/parser/Parser.y
- compiler/parser/RdrHsSyn.hs
- compiler/rename/RnExpr.hs
- compiler/typecheck/TcRnTypes.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/af3c498c47327a562d876c26f0425650609bbd69...63bee1bc03a9d883a16eb48f213da17a8394a377

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/af3c498c47327a562d876c26f0425650609bbd69...63bee1bc03a9d883a16eb48f213da17a8394a377
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190427/222877e9/attachment.html>


More information about the ghc-commits mailing list