VFUSL

From Esolang
Jump to navigation Jump to search
VFUSL
Paradigm(s) imperative
Designed by User:AlmostGalactic
Appeared in 2025
Memory system stack
Dimensions one-dimensional
Computational class Push-down automata
Reference implementation https://github.com/AlmostGalactic/VFUSL
Influenced by Forth

VFUSL (Very Full Stack Language) is a stack-based esoteric programming language where every operation is added to the stack and executed at runtime. It's designed with a mix of simplicity and flexibility, inspired by Reverse Polish Notation and other stack-oriented languages, but with its own unique flavor.

Overview

VFUSL treats every piece of input as a stack element. Code blocks, numbers, strings, and operations are all added to the stack. Execution happens in a linear pass through the stack, with commands interpreting and manipulating stack contents.

Syntax

Strings

Strings are wrapped with | characters.

Example:

|Hello, World!|

Code Blocks

Code blocks are enclosed in square brackets [ and ].

Example:

[ VFUSL CODE HERE ]

Code blocks are only executed when explicitly called with the exec command.

Commands

  • print – Prints the top value on the stack, followed by a newline.
    • Example: |Hello, World!| print
  • write – Prints the top value without a newline.
    • Example: |Hello, | write |World!| write
  • exec – Executes a code block.
    • Example: [ 123 print ] exec
  • Arithmetic: +, -, *, /, % – Basic math operations using Reverse Polish Notation.
  • Comparisons: ==, !=, <, <=, >, >=
    • Example: 2 1 > print → prints True
  • <--? – If-statement. Takes two code blocks and runs one depending on a condition.
    • Example:
1 2 > [ |True| print ] [ |False| print ] <--?
  • create – Defines a function by associating a code block with a name.
    • Example:
[ |Hello, World!| ] hello create
hello exec
  • @in, @ord, @chr – Input and character manipulation.
    • @in – Reads input
    • @ord – Converts a character to its ASCII value
    • @chr – Converts a value to its ASCII character
  • whl – While loop. Repeats a block while a condition (given as a code block) is true.
    • Example:
[ 2 1 > ] [ |FOREVER| print ] whl
  • : – Duplicates the top stack item.
  • define – Defines a variable
    • Example:
name |AlmostGalactic| define
name print
#This should print AlmostGalactic

Examples

Truth Machine

@in
0 ==
[
    # Do nothing
]
[
    [1 1 ==] [ 1 write ] whl
] <--?

Cat Program

@in
print

Calculator

|First Number: | print
num1 @in define
|Second Number: | print
num2 @in define
|Operator (+ - * /): | print
op @in define
result 0 define
op |+| ==
[
    |result| num1 num2 + define
] [
    op |-| ==
    [
        |result| num1 num2 - define
    ] [
        op |*| ==
        [
            |result| num1 num2 * define
        ] [
            op |/| ==
            [
                |result| num1 num2 / define
            ] [
                |Not supported| print
            ] <--?
        ] <--?
    ] <--?
] <--?
result print

External Resources

See Also