views:

150

answers:

3

I've been working on the specifikation / kitchensink for a meta language that can compile down to PHP for some time now. Now I want to begin building the thing. Before I have implemented tiny DSL's using PHP_Lexergenerator and PHP_Parsergenerator and they have worked very well but I have never build anything this scale before. I would appreciate any feedback / suggestions / experiences you may have greatly!

I pasted the spec at http://pastebin.com/613mFGsB.

Cheers
Rune 
+2  A: 

Haxe is a language that implements PHP as a compilation target. It seems similar to what you're trying to achieve. It's OSS, so you could take a look at how they do it.

Ilia Jerebtsov
Thats a very good idea, did not think of that, looks like though the compiler is implemented in OCaml where I'm completely blank, but there could be some interesting implementation details to scoop out.
runish
+1  A: 

pihipi is a project I did a while ago. It compiles some "better-than-php" language down to php. pihipi is written in pure c and uses re2c for lexing and lemon parser.

stereofrog
Wow, thats very interesting. Am looking through your "parser.y" and "lexer.re" files and finding them a lot nicer looking than the corresponding files in PHP core. Our goals looks very similar, only I have thrown significant whitespace into the mix. Are you still using pihipi on a daily basis when coding for PHP or did the interestingness and usefulness fade away?
runish
well, pihipi was rather a proof of concept than a practical solution.
stereofrog
Yeah I guess the last 20% of creating a parser for a new programming language takes a _lot_ of time.
runish
honestly i'm not sure there's really a need for a new programming language (except of having fun designing it). There's already a wide choice of really beautyfull langs like Io (http://iolanguage.com/), aforementioned Haxe and groovy to name a few
stereofrog
+2  A: 

Don't let similar projects by other people stop you from doing this anyways. No matter how far you get with this, what you'll really get out of this project is a further understanding of coding and parsing. You won't gain this knowledge as in depth if you simply join an existing project.

I'd also like to point out, things like Linux, Ubuntu, etc would have never existing if their original makers simply "jumped on the boat" of somebody else's similar project. Don't be afraid to make things yourself, sometimes greatness comes out of it.

TravisO
Sounds like pretty solid advice! Thx a lot!
runish