Author Topic: jscompile  (Read 691 times)

0 Members and 1 Guest are viewing this topic.

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 534
  • Country: au
    • 8bitology
  • Liked: 223
  • Likes Given: 162
jscompile
« on: 22:19, 17 July 19 »
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.
« Last Edit: 22:24, 17 July 19 by zhulien »

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 534
  • Country: au
    • 8bitology
  • Liked: 223
  • Likes Given: 162
Re: jscompile
« Reply #1 on: 21:46, 14 April 20 »
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
« Last Edit: 22:01, 14 April 20 by zhulien »

Offline m_dr_m

  • CPC664
  • ***
  • Posts: 75
  • Country: se
  • http://orgams.wikidot.com/
    • OrgaMS!
  • Liked: 60
  • Likes Given: 34
Re: jscompile
« Reply #2 on: 11:31, 15 April 20 »
I would use it if it ran on CPC (:

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.345
  • Country: au
    • index.php?action=treasury
  • Liked: 1000
  • Likes Given: 1180
Re: jscompile
« Reply #3 on: 11:33, 15 April 20 »
This is very, very cool!
My (cancelled) entry for the CPCRetroDev 2017 Competition http://www.cpcwiki.eu/forum/programming/my-cpcretrodev-2017-entry/
FAST line drawing in CPCtelera http://www.cpcwiki.eu/forum/programming/drawing-lines-with-cpctelera-sdcc/
RUNCPC My entry for the CPCRetroDev 2015 Competition http://www.cpc-power.com/index.php?page=detail&num=12494

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 534
  • Country: au
    • 8bitology
  • Liked: 223
  • Likes Given: 162
Re: jscompile
« Reply #4 on: 13:24, 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?

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 534
  • Country: au
    • 8bitology
  • Liked: 223
  • Likes Given: 162
Re: jscompile
« Reply #5 on: 06:38, 31 May 20 »
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.