pounce-lang / js-core

Core elements of a Pounce (pounce-lang) interpreter, parser, preprocessor written in TypeScript. Pounce types are being developed (a preprocess type checker is in beta)
https://pounce-lang-show-case.netlify.app/
6 stars 0 forks source link

implement `explain` #18

Open nmorse opened 2 years ago

nmorse commented 2 years ago

example [0 1 [dup2 +] 3 times] explain -->

[] [0 1 [dup2 +] 3 times] 
[0 1 [dup2 +] 3 ] [times]
[0 1] [dup2 + [dup2 +] 2 times]
[0 1 0 1] [+ [dup2 +] 2 times]
[0 1 1] [[dup2 +] 2 times]
[0 1 1 [dup2 +] 2] [times]
[0 1 1] [dup2 + [dup2 +] 1 times]
[0 1 1 1 1] [+ [dup2 +] 1 times]
[0 1 1 2] [[dup2 +] 1 times]
[0 1 1 2 [dup2 +] 1] [times]
[0 1 1 2] [dup2 +]
[0 1 1 2 1 2] [+]
[0 1 1 2 3] []