TTG hsSyn for Batch and Interactive Parsing

Simon Peyton Jones simonpj at microsoft.com
Fri May 18 14:57:35 UTC 2018


If we are always going to generate a parse tree with annotations from the parser, let’s not generate two!

I’m fine with always generating the annotations, but we just need to check that it doesn’t have insupportable costs.

Simon

From: Alan & Kim Zimmerman <alan.zimm at gmail.com>
Sent: 18 May 2018 15:31
To: Simon Peyton Jones <simonpj at microsoft.com>
Cc: ghc-devs <ghc-devs at haskell.org>
Subject: Re: TTG hsSyn for Batch and Interactive Parsing



On 18 May 2018 at 16:13, Simon Peyton Jones <simonpj at microsoft.com<mailto:simonpj at microsoft.com>> wrote:

We can’t make the result type depend on DynFlags! (Yet)(

    parser :: DynFlags -> String

  -> HsSyn (GhcPass (Parsed (if …

                            then WithApiAnnotations

                            else WihoutsApiAnnotations)

We could conceptually have

  parser :: DynFlags -> String -> Either (HsSyn (Parsed WithApiAnnotations)) (HsSyn (Parsed NoApiAnnotations))

The main point is that the next phase can make use of either of the variants.

And it may be simplest to just always use the annotations, the ParsedSource is normally discarded after renaming anyway.

Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180518/2bf1ec33/attachment.html>


More information about the ghc-devs mailing list