zephir-lang / zephir

Zephir is a compiled high-level language aimed to ease the creation of C-extensions for PHP
https://zephir-lang.com
MIT License
3.3k stars 466 forks source link

Write Zephir in Zephir #637

Closed andresgutierrez closed 3 years ago

andresgutierrez commented 9 years ago

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.

steffengy commented 9 years ago

If PHP<->Zephir was supported, the compiler would be available in both environments.

Generally i'm interested in that point:

andresgutierrez commented 9 years ago

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.

ovr commented 9 years ago

@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.

nkt commented 9 years ago

I've tried to split parser into extension, but my knowledge is not enough. Here is my trying everybody welcome to help me.

andresgutierrez commented 9 years ago

@nkt you can take the parser in Zephir JIT as example: https://github.com/phalcon/zephir/tree/master/runtime

nkt commented 9 years ago

@andresgutierrez I steal some pieces of code from runtime, phalcon annotations, but it steal fails.

andresgutierrez commented 9 years ago

What error are you getting?

gouchaoer commented 7 years ago

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.

Jurigag commented 7 years ago

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.

sergeyklay commented 5 years ago

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.

danhunsaker commented 5 years ago

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...)