New games every week!
JSE - Day Two
Blog
2nd March 2021
After a week of thinking, reading, planning and more, I finally got a good second day's grip on the Script Engine, yesterday.
-=-=- Creating a "Lexer" was the tricky part of day two. Figuring out the best way to run through the script, convert everything into different object types, and somehow "compiling" that information into a readable form for the script engine. I took a whole bunch of tips (and chunks of script!!) from this page, though I couldn't get it to work in the form given, so had to rewrite chunks of it, and find alternative ways to get it to work. I'm currently doing things in a rather unusual method, so hopefully I don't completely break things as I go, but for now at least, the script is now seemingly more functional than it previously was. Of course, at this point, the script and its output onscreen look absolutely identical. .. It's the form of the script in memory, once it's "loaded", that's different. The next challenge is to start doing maths. Where there are plusses, minuses and so on, I need to extract the values on either side, bundle them together, and output the result. I also need to take BODMAS into account, so will no doubt have to scan each thing half-a-dozen times. .. That doesn't sound very optimised, so... I'll let that whole idea ferment for a while, and see if I can figure out a neat way to do it. .. Yep. It's coming along, but it's going a lot slower than I thought it might. Maybe it'll be done by Xmas! Views 101, Upvotes 17
Daily Blog
,
Jse
New games every week!
|