<div dir="ltr">I have started a wiki page at <a href="https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/IdeSupport">https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/IdeSupport</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 8 May 2018 at 10:54, Simon Peyton Jones <span dir="ltr"><<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div link="blue" vlink="purple" lang="EN-GB">
<div class="m_2255809012018706628WordSection1">
<p class="MsoNormal"><span style="font-size:12.0pt">At first blush, “running the parser in two modes” and “changing the Pass” type don’t match up in my mind.  One seems quite local (how to run the parser).  The other seems more pervasive.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Can you say more about your proposed design, perhaps even on a wiki page?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">Simon<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> ghc-devs <<a href="mailto:ghc-devs-bounces@haskell.org" target="_blank">ghc-devs-bounces@haskell.org</a>>
<b>On Behalf Of </b>Alan & Kim Zimmerman<br>
<b>Sent:</b> 07 May 2018 16:17<br>
<b>To:</b> ghc-devs <<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a>><br>
<b>Subject:</b> TTG hsSyn for Batch and Interactive Parsing<u></u><u></u></span></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm">
I want to be able to run the GHC parser in one of two modes, batch which functions as now, and interactive which will (eventually) be incremental.<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm">
In addition, the hsSyn AST for each will have different TTG[1] annotations, so that it can better support IDE usage.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm">
I think this can be done by changing the types in HsExtension to introduce a 'Process'  type as follows<br>
<br>
data Pass = Parsed Process | Renamed | Typechecked<br>
         deriving (Data)<br>
<br>
data Process = Batch | Interactive<br>
  deriving (Show, Data)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm">
We then rename the pass synonyms so that batch is the default<br>
<br>
type GhcPs   = GhcPass ('Parsed 'Batch)<br>
type GhcPsI  = GhcPass ('Parsed 'Interactive)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm">
I have attached a simple proof of concept file, which emulates parsing and renaming.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm">
Is this an appropriate approach to take?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm">
Alan<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<u></u> <u></u></p>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
[1] Trees That Grow <a href="https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow" target="_blank">
https://ghc.haskell.org/trac/<wbr>ghc/wiki/<wbr>ImplementingTreesThatGrow</a><u></u><u></u></p>
</div>
</div></div></div>
</div>
</div>

</blockquote></div><br></div>