1. Question for Pete regarding Javascrip transpiler
- Posted by ChrisB (moderator) in February
- 614 views
Pete
A little while ago you did some demos (I think) showing Phix running in a web page (some widgets, and a fern I think)
How is this aspect of Phix going? Are those demos still available? How do I find them? Are there any docs or special instructions I can read? Any special set up instructions?
The reason I ask is that I've been playing with endbasic - write the code online, save the code online, run the code online, and I had a bit of a lightbulb moment. Could something similar be done with Phix?
My other lightbulb moment was that I suddenly understood CGI, but apparently this is old school, and likely to be deprecated now.
Cheers
Chris
2. Re: Question for Pete regarding Javascrip transpiler
- Posted by petelomax in February
- 565 views
A little while ago you did some demos (I think) showing Phix running in a web page (some widgets, and a fern I think)
How is this aspect of Phix going? Are those demos still available? How do I find them? Are there any docs or special instructions I can read? Any special set up instructions?
Not much has changed. There's a list at https://rosettacode.org/wiki/Category:Phix/online - some bitrot, most notably the filter() builtin got moved, but nothing serious.
On that page you'll also find a link to 1,257 entries (including the 100 it has) that should run fine in a browser, or you can search demo\rosetta for "with javascript_semantics".
Fire up pwa/p2js.exw and open an example or paste/type in some code (Ctrl S may be needed to update syntax colouring, error handling is still a bit brutal).
Press Run to open it in your browser. Back in pwa/p2js, Ctrl W will show you the code it has put in pwa\test.htm and the first thing you'll see is a list of the support files it needs.
If you upload all of those onto a server, like I did for the 100 linked above, then anyone should be able to run them, at least that is in a reasonably up-to-date browser.
So it is just test.htm (renamed) + p2js.js + pGUI.js + pGUI.css + builtins/*.js (59 files, from Phix/pwa/builtins), as the complete list of things that might need to be uploaded.
Note that xpGUI is still very much in progress and not ready for general use, but the untouched pGUI code (if it ever existed) should still be available in the same file as a comment.
The reason I ask is that I've been playing with endbasic - write the code online, save the code online, run the code online, and I had a bit of a lightbulb moment. Could something similar be done with Phix?
The plan is (and has been all along) to get pwa/p2js.exw running in a web browser, one day...
Let me know if you find any bits of endbasic that look like they might be useful, esp server-side php.
3. Re: Question for Pete regarding Javascrip transpiler
- Posted by ChrisB (moderator) in February
- 548 views
I never knew that had progressed so far and so well.
Cheers
Chris
4. Re: Question for Pete regarding Javascrip transpiler
- Posted by jimcbrown (admin) in February
- 557 views
I never knew that had progressed so far and so well.
Cheers
Chris
Me either. Another cheer from me!
5. Re: Question for Pete regarding Javascrip transpiler
- Posted by ChrisB (moderator) in February
- 449 views
Hi Pete
Just got round to firing up P2JS.exw (sorry, too much x-wing squadrons), and got this is error
D:\EuProgramming\Phix\pwa\src\p2js_parse.e:874 in function vardef() variable last_comma has not been assigned a value
The main file window shows. Console shows many missing / will be created *.js files (think this is what should happen). File window shows open file, and at bottom says overwriting .....pfactors.js (again, think this is supposed to happen)
Cheers
Chris
6. Re: Question for Pete regarding Javascrip transpiler (Bumped)
- Posted by ChrisB (moderator) in February
- 424 views
Hi Pete
Might have missed this
Cheers
Chris
7. Re: Question for Pete regarding Javascrip transpiler (Bumped)
- Posted by petelomax in February
- 440 views
Ah, I've created a rtn type for xpGUI and that's not properly filtered through yet.
If you replace rtn in builtins\pfactors.e with (say) called_from on lines 25, 32, and 47 it should be fine.
8. Re: Question for Pete regarding Javascrip transpiler (Bumped)
- Posted by ChrisB (moderator) in February
- 399 views
Thanks
Chris