I think you should consider implementing zephir more of as a translator rather than a compiler. What do I mean by that?
To explain the request, I will explain my problem.
Well I had a really annoying problem with routing in PHALCON that I couldn't find the answer for in the documentation.
I have been using PHALCON for a while, but even though the documentation for PHALCON is not bad at all, there things that are not very well explained, or just glossed over. So I found myself trying to solve the problems through trial and error / google searches and, lately, looking through the zephir code for phalcon 2.0.0. But even though the zephir code is close enough to PHP for easy reading (unlike the PHALCON C extension code!!!), mentally stepping through the ZEP code was not cutting it. Nothing beat simply running a test case through XDEBUG to understand the logic and the ability to view the objects states.
Basically, even though the PHP extension method really provides a performance boost, it would still be nice to have a PHP version of PHALCON to use for internal development/debugging (or for use in hosting sites that don't allow the phalcon extension).
I saw that there exists a project, in which the person basically tried to implement a version of PHALCON in PHP (but unfortunately, and expectedly) the project seems to be more or less dead and stopped at an older version of PHALCON.
Again, looking through ZEP code for PHALCON 2.0.0 it seemed relatively simple to translate to PHP. But again, why bother doing a manual translation, with all the problems that creates (maintenance, typos, etc) when we could just as easily translate the zep code to PHP. That gave me the idea that, if I some how could patch your compiler, I could get it to translate the ZEP code to PHP.
So what is the problem with the current ZEPHIR Compiler code source?
Initially, this seemed to be a simple thing to do. You already had the Lexer / Parser so in theory all I had to do was plugin for different code emitter to have a PHP version of PHALCON based on the latest ZEP code.
Unfortunately, even though I tried very hard to maintain myself within the current code structure, I found that my solution was just one BIG hack. On the other hand, all I wanted to do was code a PHP emitter plugin. But again, without having to re-write or duplicate a serious amount of your code, that wasn't possible. If I fork the compiler, I am always going to have the problem of synchronizing /patching my version of the compiler in order to maintain compatibility with yours, so instead, I was hoping that we could work towards a code based in which the C Code emitter might be less coupled with the rest of the code allowing for it's subtitution or replacement by plugins.
ZEP could truly benefit from a modular system. It would allow such things as:
- Having a PHP version of an extension (Like the case of PHALCON) so that you could easily debug the code.
- pretty printers to be easily integrated, or better yet,
- Addons/improvements to PHP.
I personally would love to have a C Preprocessor like system in ZEP/PHP, that would allow me to have code that is included only in development and not production (i.e. asserts with zero foot print in production).
Anyway this was my idea. TIA