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

Code Generator Generator #297

Closed
mo-ba opened this issue Aug 23, 2016 · 8 comments
Closed

Code Generator Generator #297

mo-ba opened this issue Aug 23, 2016 · 8 comments

Comments

@mo-ba
Copy link

mo-ba commented Aug 23, 2016

Yo DawG - I heard you like generators...

first: i love this lib!

since i saw this Issue, i thought about a generator to generate the generator via templates.
I think it should be possible parse a file, get the AST and then generate a generator script,using a GeneratorPrinter instead of the PrettyPrinter

this should make it easier to build generator scripts.

did someone try that?

Greetings

@mo-ba mo-ba changed the title Code Generator Generaor Code Generator Generator Aug 23, 2016
@TomasVotruba
Copy link
Contributor

Hey, I think this is already covered by parser generation from grammar, right?

@mo-ba
Copy link
Author

mo-ba commented Nov 1, 2017

hey, thanks for reply.

what? how?
could you provide me a link to some docs or examples or implementations?

@TomasVotruba
Copy link
Contributor

I don't now much about these things, so pardon my possibly incorrect terminology.

This package should be used in the future to generate
parser https://github.com/ircmaxell/PHP-Yacc

@nikic
Copy link
Owner

nikic commented Nov 4, 2017

@TomasVotruba PHP-Yacc is for generating parsers, I think this issue is more about generation of PHP code, though I'm not sure what exactly is being suggested.

This library used to have support for templates, see https://github.com/nikic/PHP-Parser/blob/0.9/doc/4_Code_generation.markdown#templates. However, this was dropped in version 1.0 as the functionality was pretty limited and I don't think anyone was using it at the time.

@TomasVotruba
Copy link
Contributor

I see.

Personally I prefer generating code directly by the builder. I have wrapper over it that suits more complex nodes and my personal needs.

@mo-ba Have you any proof of concept in mind?

@mo-ba
Copy link
Author

mo-ba commented Nov 16, 2017

hi guys!

i will make some prototype, when i find some time, this should explain my suggesteion

grtz

@TomasVotruba
Copy link
Contributor

How did you end up solving this @mo-ba ?

@nikic
Copy link
Owner

nikic commented May 21, 2023

Going to close this one as it's not really clear what is being asked. Worth noting that #566 links to a repo that can generate the code for constructing nodes from the AST.

@nikic nikic closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2023
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

No branches or pull requests

3 participants