Re: Compiler project

Joel de Guzman <[email protected]> Tue, 19 Jan 2010 23:55:54 +0800
Newsgroups gmane.comp.parsers.spirit.devel
Message-ID <[email protected]>
On 1/17/2010 10:58 AM, OvermindDL1 wrote:
> Has a compiler project been decided on?  Also, I think we should do

Almost. I decided to have an intermediate AST in the form of
an LISP Sexpr and the embedded compiler shall have an embedded
LISP-ish interpreter. The end compiler will be statically typed
but I'm leaning towards making the embedded interpreter dynamically
typed for ease of implementation and to avoid having to diverge too
much from LISP/Scheme syntax, but declarative, lazily evaluated
and pure no side-effects (no set!) -- reflecting the semantics
of the C++ template processor we know so dearly. IMO, that will be
ideal for dealing with a type system.

> what most compilers do, every element in the generated tree should not
> only have the information of what it is, but also the iterator range
> in the source location of the data that created it, and things higher
> in the tree contain the ranges of the things that are lower and so
> forth, this would vastly simplify error reporting, and error reporting
> is *always* a huge boon to compiled and scripting languages alike.  It
> is of course not necessary if we somehow end up generating the final
> LLVM bitcode directly from the representation, but if we do not, then
> good error reporting should be an absolute.  I think we could build
> the LLVM representation directly with a bit of work, just wonder which
> method is better...  Some languages, depending on what is chosen, will
> require post-tree visitation before LLVM generation, so that would
> require things for sure.

That's a good suggestion. In an ideal world, however, I'd like to keep
the AST in a pure form. Perhaps we can manage two trees, one for the
AST proper and one for the source information.

Regards,
-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net
http://www.facebook.com/djowel

Meet me at BoostCon
http://www.boostcon.com/home
http://www.facebook.com/boostcon




------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev