We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Walkson

From Esolang
Jump to navigation Jump to search

Walkson is a stack based 1 dimensional programming language meant as a easy as possible to implement scripting language with a unique architecture to completely forego needing a parser. It was invented and implemented by User:Uff20xd. See here

Concepts

Walkson is meant to be a fully usable and readable c-like language that abuses stacks where they shouldnt be to be implementable without needing a pesky parser to handle Context. To achieve this the language has 3 Stacks:

  • The Primary Stack
  • The Name Stack
  • The Type Stack

Every non keyword token is put onto one of these stacks and pop them based on the keyword.

Instructions

The instruction type looks like this:

 struct Instruction {
   origin_file: &Path,
   line: usize,
   pos: usize,
   instruction_type: InstructionType
 }

where InstructionType is a tagged union (or in rusts case enum) which contains token etc.

Full List of Instructions

(0-9)+

  • Integer literal

(0-9)+\.(0-9)+

  • Float literal

".*"

  • String literal

[]

  • Code block, which is pushed onto the instruction stack

add / +, sub/ - ...

  • Operations and such

Execution

Instructions are executed one by one and only require one token each (exception being InstructionPush).


Examples

These Examples have both important settings enabled, because they're pretty helpful.

Hello, World!

A simple Hello World Program:

 "Hello World" print

Cat

Takes a filename from stdin, reads the file and prints it.

 // gets stdin and calls String.split
 $stdin get String.split call
 // creates a buffer of strings as a variable
 stdin let
 // indexes into the first element, to put it onto the stack
 stdin 0 index
 // reads and prints it
 read print

Truth Machine

Takes a number from stdin and if its 0 it prints 0 and exits else it'll print one indefinitely.

 $stdin get String.split call
 stdin let
 stdin 1 index
 String.parse_int call
 pop
 copy
 [
   1 print
   loop_1 call
   1
 ] while
 print