News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_zhulien

jscompile

Started by zhulien, 20:19, 17 July 19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zhulien

Hi,


I have made a small update to jscompile, it isn't finished but enough to demo for the first time. 


It could be expanded to include assets (graphics and maps), integration with 8bitology API (for achievements), direct sending to CPC, modules etc.  Modules should be there, with classes allocated on the heap, not static, local variables on the stack to allow recursion and some code optimisations.  With modules the ability to make them public with versioning so coders can include them directly.


http://8bitology.net/poc/jscompile/


What are your thoughts on this? Should I finish it? Would anyone want to use it if it could generate CPC code?


To demo it, just type something in from scratch, eg: (yes, it is sensitive to spacing for now)



function Main1()
{
    var TEST1 = 1;
    var TEST2 = TEST1 * 5;
    var TEST3 = (TEST2 + TEST1) * 2;
   
    var loopCounter = 10;
    while (loopCounter > 0)
    {
        loopCounter --;
    }
}


Also, does anyone want to help me finish it? I prefer to make it free for any purpose.

zhulien

#1
I updated the POC of JSCompile... lots of bugs fixed, you can now type in lots of very complex logic and see it compile as you type.  No function calls just yet, but coming...


Enjoy!



https://www.youtube.com/watch?v=q8kBgWHT944

m_dr_m

I would use it if it ran on CPC (:

ervin

This is very, very cool!

zhulien

Quote from: m_dr_m on 09:31, 15 April 20
I would use it if it ran on CPC (:


If you saw my other thread about using multiple displays from CPC (via http calls), you might notice the additional screens look like CPC screens too.  This isn't coincidence, but some of the canvas work I have done already I hope to allow a program to be written and tested/debugged in JS, but compiled and also run on a real CPC. 


It would be nice to self-host it on a real CPC and time will tell if that is ever possible.  Possibilities include using revaldinho's CPCLINK card and Raspberry PI directly on CPC, or perhaps an 8BML extension to allow web-terminals?

zhulien

I have updated JSCompile at the above link to handle expressions better and more accurately and with less limitations.


Please read the notes which are as comments.


I think the remaining functionality needed to make it minimally useful is:


- new keyword object allocation
- calling functions with optional parameters
- function receiving parameters
- function return values


Mainly because I am undecided on the memory model yet, re: the other thread of mine.

Powered by SMFPacks Menu Editor Mod