4

I've been working on the specification / 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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Rune Kaagaard
  • 6,643
  • 2
  • 38
  • 29
  • 1
    Any progress on this? – musicin3d Oct 12 '17 at 21:10
  • @musicin3d It became https://github.com/runekaagaard/snowscript which can actually compile snow code to PHP. By the time I got 90% done with a 1.0 version I've stopped using PHP altogether and lost interest. – Rune Kaagaard Oct 16 '17 at 20:12

3 Answers3

6

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
  • 9,406
  • 4
  • 36
  • 44
4

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.

Alex J
  • 9,905
  • 6
  • 36
  • 46
  • 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. – Rune Kaagaard Mar 04 '10 at 12:19
2

pihipi was an interesting example of this, but now I've killed it. So check out Haxe: 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.

Shog9
  • 156,901
  • 35
  • 231
  • 235
user187291
  • 53,363
  • 19
  • 95
  • 127
  • 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? – Rune Kaagaard Mar 04 '10 at 15:26
  • Yeah I guess the last 20% of creating a parser for a new programming language takes a _lot_ of time. – Rune Kaagaard Mar 04 '10 at 15:49