Open DragorWW opened 7 years ago
Sorry for not having replied yet!
First of all: This is really great, thank you for doing that!
Initially I thought, since you already have it running on a heroku server, if it would just expose an endpoint for parsing PHP, we could use that. However, otoh I don't want to send everybodys code to some external server.
Since this is the first actual implementation for a server side language, there isn't a solution for this yet. However, I was thinking if it's possible to encapsulate all the server logic into a docker container. The container would receive the code and return the AST (as JSON I guess). The server would start and communicate with the container. There are a lot of open questions around this (e.g. should the container run all the time or should it be started per request, how does the server communicate with the container), but I believe this to be a maintainable approach in the long run (we would do the same for other server side languages).
Thoughts?
In server-side parser one problem: need backend. Heroku server will stop my container after no calls within 30 minutes.
Docker good idea for creating an abstract container with server-side parser logics.
We can store in repository docker.yml file for difference server-side parsers.
I thin need:
I could prepare docker config for PHP-Parser.
// json api example
// body string
// request
POST server.net/parser/<ParserLangName>
<bodyStringCode>
// response
// json ast
This would be really cool and it could enable so many powerful features. @fkling any thoughts on the strawman proposal above?
However, otoh I don't want to send everybodys code to some external server.
That's what I'm going to do for one other parser soon :P I don't think it's a bad idea if reusing other open-source and public services that have similar purposes.
@fkling any thoughts on the strawman proposal above?
That seems all reasonable to me. Not sure yet how the server would communicate with the container, but we have to start somewhere.
I don't think it's a bad idea if reusing other open-source and public services that have similar purposes.
No of course not. If it's a trustable resource then we should use it. But I don't want to rely on someones private instance. And thinking long-term, being able to spin up arbitrary server side parsers will make things easier.
But I don't want to rely on someones private instance.
Ah yeah agreed.
@fkling I think we can write to heroku, or similar products for hosting open source project
@DragorWW: Sure, but astexplorer already runs on its own server anyway, so running docker containers there would probably be easier for us in the long run.
For example, I use PHP-Parser on PHP and create astexplorer from ajax and php backend
how to integrate server side parse in astexplorer.net?