[Haskell-beginners] parser frontend

Konstantine Rybnikov k-bx at k-bx.com
Sat Mar 28 11:13:55 UTC 2015


Maurizio,

It's not completely clear how your compiler knows which files depend on
which. Does it read files one by one and "updates" dependency list? What
about situation when toplevel construct is split in two files, how does
this single-file API handle it?

On Fri, Mar 27, 2015 at 3:38 PM, Maurizio Vitale <mrz.vtl at gmail.com> wrote:

> G'day,
>   I'm trying to decide how to architect the frontend of a compiler I'm
> using as an excuse for learning Haskell.
>
>   Suppose we have a language (SystemVerilog) that has the notion of
> multi-file compilation units.
> This means that specific subset of files form separate scopes for certain
> things.
> For instance if we represent with lists of lists compilation units:
> [[a,b,c], [d], [e,f]]
> 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.
>
> 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:
> [[a,b,(c,d)][e,f]], where (c,d) means we're compiling the logical
> concatenation of c and d.
> If (c,d) is also incomplete, (c,d,e) should be tried and so on.
>
> 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.
>
> Any suggestion on how to go about this?
> Le's assume that parsing a file is done with a function:
> 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.
>
> I'm interested in both a sequential and parallel solution and it would be
> sweet if they where similar, with the proper abstractions.
>
> Thanks a lot for any insight/ideas,
>
>   Maurizio
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150328/a7a0657a/attachment.html>


More information about the Beginners mailing list