123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|83|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> On Topic -> JSE - Jay's Scripting Engine

Posted : Sunday, 21 February 2021, 09:11
Jayenkai

JSE - Jay's Scripting Engine


Very very very very very very basic stuff, here!!

Don't get overexcited, I might still completely screw this up!!

This is the input.


This is the output.


Things of note

1. Handles multiple spellings of the command to SetColour/Color/Col, and Rect/FillRect
2. Uses ; or : to separate commands, and happily ignores any that are left at the end of a line, ala Blitz
3. You can choose to use or not brackets as you go, again ala Blitz.
4. Graphics sets the virtual resolution, but currently everything is then scaled to "as big as will fit on the screen, with the correct aspect ratio". The 0 at the end is currently nothing, but I'll set that to be something like "1=Specifically a size, or 2=Fill with Ratio or 3=Fill the screen without care for Ratio"

Todo

Absolutely tons
My next task is to parse variables. Good lord, that's not going to be easy, is it!?!

-=-=-
''Load, Next List!''
Posted : Sunday, 21 February 2021, 09:17
Jayenkai
Reasons for doing this..

The other day I had two events both shout and scream in my ear that I ABSOLUTELY should do this.

First, I was battling with a mini game idea and cursing myself that I'd have to code a great big Javascript game for what would essentially be a tiny little mini game. "Could do with a scripting engine, here, Jay!" I said..

Trying to calm myself down, and stop myself from giving myself insane amounts of work, I instead came over to SoCoder to think straight for a bit, at which point I got irrationally annoyed at Godot Online, because as much as it "is" online, it's kind of a pain in the arse, and you can't simple copy+paste code into it and see the code run..

So..
Yeah, two very different signs for essentially the same thing..

Ugh..
Am I really doing this!?!?
Fuxake..

-=-=-
''Load, Next List!''
Posted : Sunday, 21 February 2021, 09:51
Pakz
I remembered this book that can be read for free online :

https://eloquentjavascript.net/12_language.html

This chapter teaches how to program a language. I bought a book on compiler programming a couple of years ago but it was beyond my skills. It only showed code to write a compiler(s) written in the authors own programming language.
Posted : Monday, 22 February 2021, 01:27
spinal
Sounds brain scrambling...
Posted : Monday, 22 February 2021, 08:22
Jayenkai
You know when you have a little idea, and then KABOOOM it's 70,000,000 times bigger overnight and you realise you have an absolute ton of stuff to do...

CBA today.. Have to make a bloody sprite editor and everything.. FFS!!!

-=-=-
''Load, Next List!''
Posted : Monday, 01 March 2021, 07:00
Jayenkai
Day Two..
.. Yes, Day Two.

I've spent the past week or so reading through various Lexer techniques, and wondering where/how to implement it.
I've opted to do a Compiler-esque Lexer parse at the star, parse the code, chop it into chunks, stick little flags all over the code, and then run the messy version in realtime.
It seems .. ok.. I think..



Although this screenshot appears identical to the previous one, the script is doing a lot more work in-between it being "a script" and being a semi-parsed script.

Next challenge, mathematicalising!!!

-=-=-
''Load, Next List!''
Posted : Monday, 01 March 2021, 11:01
spinal
If you want to port this to arduino and allow me to use it in a project, I won't stop you

-=-=-
Check out my excellent homepage!
Posted : Monday, 01 March 2021, 11:50
Jayenkai
LazyJaycode, right now. I'd likely have to triple-rewrite it, (that thing where you scrap and rewrite over and over to hopefully make it "better" each time) in order to reduce it to a small enough size for Arduino.
Currently there's a ton of string checks/comparisons, which wouldn't exactly be ideal on there.

-=-=-
''Load, Next List!''
Posted : Monday, 01 March 2021, 12:15
spinal
Only half serious It does sound like a useful project though.

-=-=-
Check out my excellent homepage!