guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PHP language translator for Guile?


From: Andy Wingo
Subject: Re: PHP language translator for Guile?
Date: Thu, 25 Mar 2010 12:20:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Hi Jon,

On Thu 25 Mar 2010 02:58, Jon Herron <address@hidden> writes:

> I have an interest in writing a PHP interpreter in Scheme and have spent
> the last couple of days evaluating various Scheme implementations to
> use. After looking at Guile for a bit it appears there is a framework
> for implementing languages besides scheme itself (I noticed ecmascript
> and brainfuck are the in tree), then after checking out the website some
> more I noticed PHP was mentioned as a desired language to be translated
> to Guile. Is this still true? If so I would really like to take a crack
> at adding this feature. I am very new to this type of development but
> feel this would be a great dive to take.

Sounds interesting!

Creating a good PHP implementation would be a lot of work, because PHP
users expect for there to be a big standard library. But if you just
wanted to implement the core semantics, it shouldn't be that
difficult -- a couple months' work, I would imagine.

I hand-wrote a lexer for ECMAScript, but you might want to investigate
Silex, a lexer generator; then use the LALR-SCM library that the ES
compiler uses to parse PHP. From there you compile to tree-il, then
write whatever pieces of a runtime that you need.

The ES compiler is really the reference here, but it is not as clean as
it could be. Apologies for that, and happy hacking!

Andy

ps. Check Guile out from git, build the manual, then look in the "Guile
Implementation" chapter for how to implement another compiler.
-- 
http://wingolog.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]