Science Zero
[ Science ] [ Electronics ] [ Experiments ] [ Computing ] [ About us ] [ Links ]
| Matrix This is a stack based language with a two-dimensional program pointer. It has no practical purpose except for making you think. It was made for exploring the feasability of constructing a two-dimensional microcontroller. The concept of two-dimensional programs fits well with the human mind but seems to have no real benefits for a CPU. This project may surface again as a two-dimensional compiler. It uses Reverse Polish Notation. Using reverse Polish notation makes it possible to make a language that is almost syntax free as opposed to the syntax quagmire of C++. Interpreter and some samples: matrix2.zip (1.9MB) |
Command Reference |
||
| Program flow
|
> | right |
| v | down | |
| < | left | |
| ^ | up | |
| # | compare - low=left, high=right, equal=straight on | |
| ¤ | set Program Counter stride | |
| jmp | set Program Counter | |
| : | call function | |
| ; | return from function | |
| @ | stop | |
| Data Matrix
|
u | up |
| d | down | |
| l | left | |
| r | right | |
| x | memory x position = integer | |
| y | memory y position = integer | |
| ?d | integer = data Matrix | |
| !d | data Matrix = integer | |
| String Stack Operations | +" | join |
| len | integer = length of string | |
| mid | string = char N | |
| msg | message box string | |
| val | integer = string | |
| val. | float = string | |
| dup" | duplicate | |
| del" | delete | |
| swp" | swap | |
| ?" | peek string stack | |
| !" | poke string stack | |
| Real Stack Operations | +. | addition |
| -. | subtraction | |
| *. | multiplication | |
| /. | division | |
| sqrt. | square root | |
| str. | string = float | |
| and. | and | |
| or. | or | |
| eor. | eor | |
| dup. | duplicate | |
| del. | delete | |
| swp. | swap | |
| ?. | peek float stack | |
| !. | poke float stack | |
| Integer Stack Operations
|
+ | addition |
| - | subtraction | |
| * | multiplication | |
| / | division | |
| sqrt | square root | |
| and | and | |
| or | or | |
| eor | eor | |
| int | integer = float | |
| str | string = integer | |
| chr | string char = integer | |
| del | delete | |
| dup | duplicate | |
| swp | swap | |
| ? | peek integer stack | |
| ! | poke integer stack | |