Settings

Theme

Show HN: The Taka Programming Language

codeberg.org

12 points by mgunyho 21 days ago · 4 comments · 1 min read

Reader

Hi HN! I created a small stack-based programming language, which I'm using to solve Advent of Code problems. I think the forward Polish notation works pretty nicely.

theamk 20 days ago

Neat!

Forward polish notation + multi-line programs is _weird_ though. It means you read tokens _right-to-left_ and then top to bottom. Readme gives good example in [0]:

The long form (same in Taka or Forth) of

    4
    3
    2
    +
is equivalent in Taka to

    3 4
    + 2
(and both leave 5 on top of stack, and 4 underneath it)

[0] https://codeberg.org/marton/taka#basic-syntax-and-execution

  • mgunyhoOP 20 days ago

    Yep, I think in Taka the most confusing case is lists - writing

        list [
         1
         2
         3
        ]
    
    creates the list [3 2 1]. (When indexing, the first item of the list is the one on top of the stack.) This has tripped me up several times.
pmdulaney 21 days ago

Is there an advantage to using PN as opposed to RPN? Those of us used to Forth, PostScript, dc, might find it difficult to switch paradigms.

  • mgunyhoOP 21 days ago

    PN makes it appear more like a traditional programming language on the surface, even if it's still read in a kind of strange way. So it might help spread the joy of stack languages by seeming more easily approachable. For me personally, RPN is still unfamiliar enough that this kind of PN feels more comfortable.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection