On 10/02/2015, at 3:42 PM, Martin DeMello wrote:

> On Mon, Feb 9, 2015 at 2:56 PM, john skaller
> <skal...@users.sourceforge.net> wrote:
>> 
>> I would actually like to rework the whole front end of the flxg
>> compiler in scheme. What I mean is that the core workhorse
>> algorithms would still be in Ocaml, but they'd be sequenced
>> by scheme code. OCS Scheme is written in Ocaml and allows
>> extra primitive procedures and data types written in Ocaml to
>> be added to it.
> 
> What is the motivation behind that? OCaml strikes me as a much nicer
> language than scheme to write compilers in (much as I love scheme).

Ocaml lacks the ability for the end user to extend it.

On can't extend the Felix system by separately compiled
dynamically loaded plugins with Ocaml (at least not with the
native code compilers). Yes, Ocaml has dynamic loading but it
is fairly restricted in scope.

At present a lot of constructions were added by me by just writing
a bit of grammar and some scheme that emitted some sequences
of existing terms. The compiler flxg just reads the grammar files
as part of the "library".

I picked scheme because 

(a) it's vaguely functional
(b) it's interpreted (more or less)
(c) its fairly good at producing ASTs 
(d) there was a readily available library for Ocaml (OCS scheme)
(e) scheme is a "standard" language

So I'm not talking about writing the compiler in scheme, but organising
the sequencing of the phases in scheme, and also providing hooks
for users to intervene at appropriate points with library code.

Constant folding is the motivating example. It's done in Ocaml
at the moment. For bool,int,string.

The problem is .. Felix doesn't HAVE these types. They're actually
defined in the library. So the rules for constant folding should
be too. But they're not, they're defined in Ocaml. So its a hack.


--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to