Programming language using PEGjs/peggy #185
Replies: 2 comments 1 reply
-
I'd like to add a section to the website with known uses of Peggy/PegJS. Let's turn this issue into the one tracking that, then add kopi to the list when it exists. |
Beta Was this translation helpful? Give feedback.
-
While working on Kopi, I like to have a very basic, trimmed down implementation for reference. I modified the Arithmetics Grammar example to first create an AST, then interpret it. I think it gives a nice, minimal example of a full interpreter, using left-associative and right-associative operators, and naming rules common to many languages (PrimaryExpression, NumericLiteral, etc.). It can be copied and pasted into the online PEG editor.
|
Beta Was this translation helpful? Give feedback.
-
I've worked on many variations of a programming language over the years. Recently, a new variation has solidified and is starting to feel "right", called Kopi. It is...
Simple – 'match' for example, is simply a function, and pattern matching is just an n-tuple of anonymous functions.
Immutable – Shared mutable data is bad, but some impure functions such as 'print' and 'random' are handy.
100% Async – 'input' simply waits for user input and resolves as an argument to 'match'. 'sleep' does the same.
It's kind of a LISP-ish runtime with a Haskell-ish syntax running inside of JavaScript (Node). It's using PEGjs (will likely convert to peggy), and can be found here: https://github.com/mikeaustin/kopi. It's still in the experiment phase, so no prod use, yet :)
Beta Was this translation helpful? Give feedback.
All reactions