Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmadisetti/sona.js
a simple language with a 1000 character interpreter inspired by toki pona
https://github.com/dmadisetti/sona.js
esolang programming-language toki-pona
Last synced: about 1 month ago
JSON representation
a simple language with a 1000 character interpreter inspired by toki pona
- Host: GitHub
- URL: https://github.com/dmadisetti/sona.js
- Owner: dmadisetti
- License: mit
- Created: 2021-09-15T21:45:05.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-13T21:57:18.000Z (almost 3 years ago)
- Last Synced: 2024-07-30T18:14:33.462Z (5 months ago)
- Topics: esolang, programming-language, toki-pona
- Language: JavaScript
- Homepage: https://observablehq.com/@dmadisetti/sona
- Size: 424 KB
- Stars: 76
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# toki sona
[![tests](https://github.com/dmadisetti/sona.js/actions/workflows/tests.yml/badge.svg)](https://github.com/dmadisetti/sona.js/actions/workflows/tests.yml)
[![playground](https://img.shields.io/badge/playground-sona-white.svg?logo=observable)](https://observablehq.com/@dmadisetti/sona)a simple language with a 1000 character interpreter inspired by toki pona
---
![toki sona pi toki sona](https://raw.githubusercontent.com/dmadisetti/sona.js/main/sona.png)
## example sona program (calculates the first 10 primes)
```
ma SonaPiNanpaKiwen# nanpa pi pali pini
ijo Nanpa li 10
# ken nanpa kiwen
ijo NanpaKiwen li 1ma Kiwen
ken Nanpa li 0 la pini
# ijo nanpa kiwen en wan li kiwen o ala kiwen?
ijo NanpaKiwen li NanpaKiwen en 1# pali sona pi nanpa ko
ijo NanpaKo li 1
ma Ko
ijo NanpaKo li NanpaKo en 1
ken NanpaKiwen li NanpaKo la nanpa NanpaKiwen
# ante wan la ijo sona li pali e pini
ken NanpaKiwen li NanpaKo la ijo Nanpa li Nanpa ante 1
ken NanpaKiwen li NanpaKo la tawa Kiwenijo NanpaTenpo li NanpaKiwen weka NanpaKo
ijo NanpaTenpo li NanpaTenpo mute NanpaKo
# nanpa li ala kiwen. nanpa li ko
ken NanpaTenpo li NanpaKiwen la tawa Kiwen# nanpa li ken kiwen
tawa Ko
```### why
why not
### what
`ijo` `` `li` `[Expression]` : Assign Variable
`ken` `[Expression]` `la` `[Expression]` : If then
`ma` `` : Create goto mark
`tawa` `` : Goto markername
`nanpa` `[symbols]`: adds number to return stack
`toki` `[symbols]`: adds ascii to return stack
`pini` : Halt the program and returns stack
#### expressions
`A` `ala`: not A
`A` `anu` `B`: bitwise or
`A` `en` `B`: addition
`A` `ante` `B`: subtraction
`A` `mute` `B`: multiplication
`A` `weka` `B`: division
`A` `li` `B`: equality check
### notes
Integer only math. Paternalistic PascalCase. Forgives over fails. Good luck debugging.