<div dir="ltr">I think this goes a very long way towards what I need: <a href="https://github.com/ekmett/speculation">https://github.com/ekmett/speculation</a><div><br></div><div>If anybody has any suggestion on other libraries that can be of use when trying to parallelize a parser, I'd be very interested in hearing it.</div><div><br></div><div>Thanks,</div><div><br></div><div> Maurizio</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 27, 2015 at 9:38 AM, Maurizio Vitale <span dir="ltr"><<a href="mailto:mrz.vtl@gmail.com" target="_blank">mrz.vtl@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">G'day,<div> I'm trying to decide how to architect the frontend of a compiler I'm using as an excuse for learning Haskell.</div><div><br><div> Suppose we have a language (SystemVerilog) that has the notion of multi-file compilation units.</div><div>This means that specific subset of files form separate scopes for certain things.</div><div>For instance if we represent with lists of lists compilation units:</div><div>[[a,b,c], [d], [e,f]]</div><div>a macro definition in file b, would affect the rest of the file and file c, but wouldn't have effect on files d,e or a.</div><div><br></div><div>Furthermore, if a toplevel construct is split between two files, say c and d, the compiler should treat the original compilation unit specification as if it was:</div><div>[[a,b,(c,d)][e,f]], where (c,d) means we're compiling the logical concatenation of c and d.</div><div>If (c,d) is also incomplete, (c,d,e) should be tried and so on.</div><div><br></div><div>Now in well designed systems, all files can actually be compiled in parallel and so I'd like to optimize for that case and recompile files (either because we need side effects from files before them or because they're incomplete. So I'm not to concerned if wasted work is done for the degenerate cases.</div></div><div><br></div><div>Any suggestion on how to go about this?</div><div>Le's assume that parsing a file is done with a function:</div><div>p :: file -> Either Error (ast, [defs], [use]) where the [defs] are things that might affects files down the line and [use] are things that, if defined by some prior file, cause recompilation.<br></div><div><br></div><div>I'm interested in both a sequential and parallel solution and it would be sweet if they where similar, with the proper abstractions.</div><div><br></div><div>Thanks a lot for any insight/ideas,</div><div><br></div><div> Maurizio</div></div>
</blockquote></div><br></div>