Ljzn / mini_forth

https://mini-forth.vercel.app
BSD 2-Clause "Simplified" License
17 stars 5 forks source link

Keep it concise. Port to javascript #11

Closed Ljzn closed 3 years ago

Ljzn commented 4 years ago

The language has become a little too complex than I expected. In the beginning, I only want these features:

Then, other features are added:

Things began to become more and more complicated and gradually lost its initial meaning. I realized the key is just "compile to opcodes" not "a language can do anything off-chain". In fact, using simple string replacing we can inject the off-chain data into the MiniForth:

: word1
  {{ arg }} dup +
;

Just replace the {{ arg }} with any off-chain computed data, people can use any programming language to do the off-chain stuff.

Now I will focus on the 3 initial goals above, and port the compiler into JS. (the bsv.js has a great interpreter we can use it).

Ljzn commented 3 years ago

https://github.com/Ljzn/mini_forth/blob/master/j/mini.pegjs