Hi all! I created a little stack-based programming language which I'm using to solve Advent of Code this year. It's not as revolutionary as most of the projects here, the most interesting feature is the syntax, which uses forward Polish notation. In the future, I want to explore if this could work well for REPL-driven development.
📝 taka
The Taka programming language
I'm twenty years into this racket and it's never before occurred to me that RPN implies FPN. So that's cool.
Kind of but not really. The grouping happens by the number of items a function consumes from the stack instead of parens.
various asides (hoping that they might provide further inspiration)...
- the correct term for
forward polish notationispolish notation(Perplexity (LLM)) - APL uses right-to-left evaluation but "parses" based on the operator,
2 x 3 + 4evaluates to 14 (not 10) - Perplexity clarification: APL uses strict right-to-left associativity with uniform precedence
+ * 2 3 4in Taka is(+ (* 2 3) 4)in lisp and(2 x 3) + 4in APL and2 x 3 + 4in grade-school math and infix-with-precedence PLs2 x 3 + 4in APL is(* 2 (+ 3 4))in lisp, hence,* 2 + 3 4in Taka (?) and3 4 + 2 *in Forth- TCL uses Polish Notation by default (TCL's
exprprovides infix) - Dylan, before being converted to infix, was Polish Notation (perplexity)
- Lisp REPLs traditionally use the variable
*to denote the last value computed in the REPL,**for the next-to-last, and so on (in lisp, the character*placed in the first position of an expression is treated as an operator not a variable (which leads into the lisp-2 v. lisp-1 rabbit hole) - REPLs are for program development, so "efficiency" has a different meaning (in a REPL, developer turn-around time is more important than production-level "efficiency")
- I would be interested in your comments on the following thought, as you go down the REPL learning curve: I wonder if we no longer need to build REPLs into languages, but that we need to build languages around the UNIX shell to form a REPL capable of running many languages? I think that REPL is spelled wrong. There should be 2 P's. REPPL.
- Not now, but, when you get back to exploring REPLs, you might wish to look at (and discuss) the following thoughts and further reading
programmingsimplicity.substack.com/p/we-lost-something-1970s-repls-were?r=1egdky
In the 1970s, Lisp and APL REPLs represented something we’ve lost: true interactive, exploratory programming environments where developer feedback was instantaneous, context was persistent, and the entire system was designed around the developer’s cognitive workflow.
...
For decades, programming languages have tried to optimize for both development and production simultaneously, a conflation that created unnecessary complexity.
...
This loss is one of my topics in Redressing the Balance: A Yin-Yang Perspective on Information Technology. It's sad to look back at 30 years of working in computational science and noting that my (almost) first environment, APL, was the best I ever had in terms of being made for the work I do.
"Almost" because my very first programming environment was BASIC on a TRS-80. I learned APL (initially on an IBM mainframe) a year later.
