Now we add #Rhai Scripting to #BL602 Simulator ... The Drag-n-Drop Way!

https://github.com/lupyuen2/blockly-bl602

GitHub - lupyuen2/blockly-bl602: Blockly for BL602 / BL604 and Rhai Script

Blockly for BL602 / BL604 and Rhai Script. Contribute to lupyuen2/blockly-bl602 development by creating an account on GitHub.

What is #Rhai Script? It's a #RustLang-like Scripting Language that we're porting to #BL602 Simulator

https://github.com/lupyuen/bl602-simulator/tree/main/bl602-script

bl602-simulator/bl602-script at main · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

We have modded #Blockly to generate #Rhai Scripts for #BL602 Simulator

https://github.com/lupyuen2/blockly-bl602

GitHub - lupyuen2/blockly-bl602: Blockly for BL602 / BL604 and Rhai Script

Blockly for BL602 / BL604 and Rhai Script. Contribute to lupyuen2/blockly-bl602 development by creating an account on GitHub.

#Rhai lets us register our #RustLang Module with the Script Engine ... So calling the #BL602 Rust Wrapper is no problemo!

https://github.com/lupyuen/bl602-simulator/blob/main/bl602-script/src/lib.rs

bl602-simulator/lib.rs at main · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

#Rhai Script runs OK on #BL602 WebAssembly Simulator ... But to run on Real BL602 Hardware we shall transcode to uLisp

https://lupyuen.github.io/articles/rustsim?25#appendix-rhai-scripts-on-bl602

Rust on RISC-V BL602: Simulated with WebAssembly

Can we run Rust Firmware for BL602 RISC-V SoC in a Web Browser... Simulated with WebAssembly?

How to Transcode #Rhai Script to #uLisp? We walk the Abstract Syntax Tree and convert every node

https://github.com/lupyuen/bl602-simulator/blob/main/bl602-script/src/lib.rs#L158-L192

bl602-simulator/lib.rs at main · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

#Rhai Abstract Syntax Tree will have Gnarly Nested Nodes ... Transcoding to uLisp will be an interesting challenge!

https://github.com/lupyuen/bl602-simulator/blob/main/bl602-script/src/lib.rs#L193-L284

bl602-simulator/lib.rs at main · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

StaticVec in rhai - Rust

(internals) Alias to `smallvec`, which is a specialized [`Vec`] backed by a small, inline, fixed-size array when there are ≤ 4 items stored. Exported under the `internals` feature only.

Here's how we compile #Rhai Script to Abstract Syntax Tree ... Then walk the tree and transcode to uLisp #BL602

https://github.com/lupyuen/bl602-simulator/blob/transcode/bl602-script/src/transcode.rs

bl602-simulator/transcode.rs at transcode · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

bl602-simulator/transcode.rs at transcode · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

Transcoding #Rhai Function Calls to uLisp #BL602 ... Needs more work because of the "StackSlot" parameters 🤔

https://github.com/lupyuen/bl602-simulator/blob/transcode/bl602-script/src/transcode.rs#L107-L141

bl602-simulator/transcode.rs at transcode · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

bl602-simulator/transcode.rs at transcode · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

bl602-simulator/transcode.rs at transcode · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

bl602-simulator/transcode.rs at transcode · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

Let's add a #RustLang Module to manage the Nested uLisp Scopes for #BL602 ... Like "let*" and "dotimes"

https://github.com/lupyuen/bl602-simulator/blob/transcode/bl602-script/src/scope.rs

bl602-simulator/scope.rs at transcode · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

bl602-simulator/transcode.rs at transcode · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

bl602-simulator/transcode.rs at transcode · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

bl602-simulator/bl602-script at transcode · lupyuen/bl602-simulator

BL602 / BL604 Simulator in WebAssembly. Contribute to lupyuen/bl602-simulator development by creating an account on GitHub.

Run #Rhai Scripts on #BL602 (and BL604) ... By auto-converting to uLisp! All shall be explained in this article

https://lupyuen.github.io/articles/rhai?1

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Making #BL602 and BL604 Firmware Coding a little less frustrating ... With #RustLang and WebAssembly

https://lupyuen.github.io/articles/rhai?2#bestest-outcome

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Now we add #Rhai Scripting for #BL602 and BL604 ... The Drag-N-Drop Way!

https://lupyuen.github.io/articles/rhai?3#bestest-outcome

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Here are the #Rhai Scripts that will be supported on #BL602 and BL604

https://lupyuen.github.io/articles/rhai?4#rhai-scripts

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Here's how we add the #Rhai Scripting Engine to our BL602 Simulator in #RustLang

https://lupyuen.github.io/articles/rhai?5#add-rhai-scripting-to-simulator

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Calling #RustLang Functions from #Rhai Script ... In BL602 Simulator

https://lupyuen.github.io/articles/rhai?6#register-function

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Converting #Rhai Script to uLisp ... In #BL602 WebAssembly Simulator

https://lupyuen.github.io/articles/rhai?8#convert-rhai-to-ulisp

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

What's an Abstract Syntax Tree? Why is it perfect for converting #Rhai Script to #uLisp?

https://lupyuen.github.io/articles/rhai?9#abstract-syntax-tree

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Converting Statements and Expressions ... From #Rhai Script to #uLisp

https://lupyuen.github.io/articles/rhai?10#rhai-transcoder

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Rewriting "let" and "for" statements ... From #Rhai Script to #uLisp

https://lupyuen.github.io/articles/rhai?11#transcode-statement

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

#Rhai Maintainers are watching our work on #BL602 and BL604 yay! 🎉

https://github.com/lupyuen2/blockly-bl602/issues/1

Transcode Rhai to S-Expressions · Issue #1 · lupyuen2/blockly-bl602

Hi, maintainer of Rhai here. I see that you're transcoding Rhai into an S-expression syntax. Wonder how you're doing that and whether there is anything we can do to help.

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?

Can we drag-n-drop (Rust-like) #Rhai Scripts ... And run them on #BL602 and BL604? Let's find out!

https://lupyuen.github.io/articles/rhai

Rust on RISC-V BL602: Rhai Scripting

Can we drag-and-drop Rhai Scripts... And run them on WebAssembly and BL602 RISC-V SoC?