Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start the Rosetta initiative for bring hlphp back up to speed #109

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

allejo
Copy link
Collaborator

@allejo allejo commented May 16, 2023

Greetings! If you've landed in this PR, then you've been linked to it by me, notified about it because you're watching this repo, or you're incredibly curious about what the fuck I am doing. Here's the situation:

Since the release of highlight.js v10, JSON-only language definitions were no longer possible because hljs introduced function support into language definitions. Historically, highlight.php (hlphp) has relied on JSON-only representations of language definitions but there's no way to represent functions in JSON. So does that mean the death of this project? Am I going to be manually maintaining 190+ language definitions?

Here's the crazy idea I came up with one night while being in an impaired state, why not write a translator for language definitions written in JavaScript to now be written in PHP? Are there existing projects out there at attempted this? Yes. The ones I've found are not as active or do not support modern JS syntax.

Enter, Rosetta-PhpScript. Internally, it uses Babel to generate an AST and then I parse that AST and start translating it into a valid PHP AST that nikic's php-parser can handle and then generate valid PHP.

Is there an ETA on this? Nope! My former employer has suddenly gifted me "time off", so I've got some time to kill. I'm hoping to get this project done this summer but no promises!

@n-peugnet
Copy link

Hi, just curious about the state of this initiative. Do you consider it viable? Is there something blocking it?
Maybe there is something I can do to help you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants