Closed andresgutierrez closed 3 years ago
If PHP<->Zephir was supported, the compiler would be available in both environments.
Generally i'm interested in that point:
Zephir provides many aids to find errors and problems in advance (static type analysis, warnings, etc) which would help us a lot to improve the quality of the compiler. The parser (which is currently in C) could be part of a single extension increasing the performance as the overhead of calling zephir-parse
executable is removed. This is a goal we're pursuing also in #552
Additionally represents another major project that would serve as an example to improve Zephir and serves as an example of its potential. I have no doubt that this would be a great project and now is not the time to address this. Just letting this for the sake of discussion.
@andresgutierrez
It's a perfect idea to write Zephir on Zephir lanuage
But I think We need to split CodeGenerator and Parser into other components before "We migrate Zephir To Zephir". It's more priority.
If we create a PHP Parser Component for Zephir, It can give more popularity for project and new contributors.
I've tried to split parser into extension, but my knowledge is not enough. Here is my trying everybody welcome to help me.
@nkt you can take the parser in Zephir JIT as example: https://github.com/phalcon/zephir/tree/master/runtime
@andresgutierrez I steal some pieces of code from runtime, phalcon annotations, but it steal fails.
What error are you getting?
php7 is improving, especcialy on performance(jit will merge into master soon) and static type(we now have scalar typehint in function parameter). it has prooved that in a normal application(the opened issue) zephir has the same performance as php. i can not see any advantage on using zephir to write zephir. zephir is not a meta-language of php(you can not translate it into php) but they all run on php runtime. i think zephir should keep close to php, be able to utilize php's libs and make up drawbacks of php, not stay away from php.
Anyway idea of runtime and writing zephir code in zephir i think was dropped but not sure about it, compilation of this runtime think is not possible atm i last checked.
To become a Turing-complete (or Turing-powerful) Zephir has to be written on Zephir. To achieve this we can introduce a brand new backed (say C++Backend
, or GolangBackend
). This will allow us to create programs that can work without Zend Engine support.
This isn't to say ZendEngine backends will go away. That wouldn't serve any purpose, here. Instead, the proposed new backend would be an additional one. (For those who didn't catch that above...)
At some point, Zephir will allow us to write the AOT compiler itself in Zephir instead of using PHP. Keeping this thread open for discussion.