简体   繁体   English

实现编译为PHP的元语言的最佳方法

[英]Best way to implement a meta language compiling down to PHP

I've been working on the specification / kitchensink for a meta language that can compile down to PHP for some time now. 我一直致力于规范/ kitchennsink的元语言,可以编译成PHP一段时间了。 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. 在我使用PHP_Lexergenerator和PHP_Parsergenerator实现微型DSL之前,它们已经运行良好,但我之前从未构建任何这样的规模。 I would appreciate any feedback / suggestions / experiences you may have greatly! 非常感谢您提供的任何反馈/建议/经验!

I pasted the spec at http://pastebin.com/613mFGsB . 我在http://pastebin.com/613mFGsB粘贴了规范。

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. 我还想指出,如果他们的原始制造商只是“跳上了别人的类似项目”,那么像Linux,Ubuntu等这样的东西就不会存在。 Don't be afraid to make things yourself, sometimes greatness comes out of it. 不要害怕自己制造东西,有时候会有伟大的成就。

Haxe is a language that implements PHP as a compilation target. Haxe是一种将PHP作为编译目标的语言。 It seems similar to what you're trying to achieve. 它似乎与您想要实现的类似。 It's OSS, so you could take a look at how they do it. 这是OSS,所以你可以看看他们是如何做到的。

pihipi was an interesting example of this, but now I've killed it. pihipi是一个有趣的例子,但现在我已经杀了它。 So check out Haxe: Haxe is a language that implements PHP as a compilation target. 请查看Haxe:Haxe是一种将PHP作为编译目标的语言。 It seems similar to what you're trying to achieve. 它似乎与您想要实现的类似。 It's OSS, so you could take a look at how they do it. 这是OSS,所以你可以看看他们是如何做到的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM