* PHP language translator for Guile?
@ 2010-03-25 1:58 Jon Herron
2010-03-25 11:20 ` Andy Wingo
0 siblings, 1 reply; 4+ messages in thread
From: Jon Herron @ 2010-03-25 1:58 UTC (permalink / raw)
To: guile-devel
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.
Anyway, just thought I would reach out to the group and see what the general take on this idea was.
Thanks,
Jon
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PHP language translator for Guile?
2010-03-25 1:58 PHP language translator for Guile? Jon Herron
@ 2010-03-25 11:20 ` Andy Wingo
2010-03-25 18:59 ` Jon Herron
2010-04-02 2:10 ` Jon Herron
0 siblings, 2 replies; 4+ messages in thread
From: Andy Wingo @ 2010-03-25 11:20 UTC (permalink / raw)
To: Jon Herron; +Cc: guile-devel
Hi Jon,
On Thu 25 Mar 2010 02:58, Jon Herron <jon.herron@yahoo.com> 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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PHP language translator for Guile?
2010-03-25 11:20 ` Andy Wingo
@ 2010-03-25 18:59 ` Jon Herron
2010-04-02 2:10 ` Jon Herron
1 sibling, 0 replies; 4+ messages in thread
From: Jon Herron @ 2010-03-25 18:59 UTC (permalink / raw)
To: Andy Wingo; +Cc: guile-devel
Thanks for the reply. I agree PHP does have a big standard library, but was hoping to get the core semantics working first, then take it from there. The pointers are much appreciated, I'll start to investigate Silex and dig through the manual. I'm sure there will be questions along the way, can't wait to get started though.
Thanks again,
Jon
--- On Thu, 3/25/10, Andy Wingo <wingo@pobox.com> wrote:
> From: Andy Wingo <wingo@pobox.com>
> Subject: Re: PHP language translator for Guile?
> To: "Jon Herron" <jon.herron@yahoo.com>
> Cc: guile-devel@gnu.org
> Date: Thursday, March 25, 2010, 11:20 AM
> Hi Jon,
>
> On Thu 25 Mar 2010 02:58, Jon Herron <jon.herron@yahoo.com>
> 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/
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PHP language translator for Guile?
2010-03-25 11:20 ` Andy Wingo
2010-03-25 18:59 ` Jon Herron
@ 2010-04-02 2:10 ` Jon Herron
1 sibling, 0 replies; 4+ messages in thread
From: Jon Herron @ 2010-04-02 2:10 UTC (permalink / raw)
To: Andy Wingo; +Cc: guile-devel
Just wanted to send a quick update, I haven't had as much time as I hoped to work on this, but do have a lexer generated with Silex. So far in really quick tests this seems to produce the proper tokens (at least in simple cases). I'm hooked up to the new LALR-SCM module (system base lalr) and am starting to define my grammars. Currently only PHP's T_INLINE_HTML tokens are handled (any text outside the PHP tags). Very basic I know, still no Tree-IL/runtime, but it's coming. The needed files are added to modules/Makefile.am - after a make && make install I can run guile and do a ,L php - at least to me that's pretty cool, heh.
I'm going to keep on trucking, but just wanted to say at least some progress has been made. Hopefully before long I'll have some code that is worth sharing. Big thanks to the Guile team for setting all the ground work, so far everything has been pretty smooth.
Thanks,
Jon
----- Original Message ----
From: Andy Wingo <wingo@pobox.com>
To: Jon Herron <jon.herron@yahoo.com>
Cc: guile-devel@gnu.org
Sent: Thu, March 25, 2010 7:20:53 AM
Subject: Re: PHP language translator for Guile?
Hi Jon,
On Thu 25 Mar 2010 02:58, Jon Herron <jon.herron@yahoo.com> 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/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-04-02 2:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-25 1:58 PHP language translator for Guile? Jon Herron
2010-03-25 11:20 ` Andy Wingo
2010-03-25 18:59 ` Jon Herron
2010-04-02 2:10 ` Jon Herron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).