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.

Wolf

From Esolang
Jump to navigation Jump to search

Wolf is an esoteric programming language (esolang) inspired by canine behavior, pack structure, and data management. It combines a dynamic user-input greeting with scoped variable registers and a centralized global stack. All in 1 little python file!!


Core Concepts

Variable Scoping Rule

Wolf features strict lexical isolation for local variables:

  • Local Variables: Any variable declared inside a function via howl cannot be seen or altered by the rest of the program. Likewise, a variable declared outside a function cannot be used inside a function.
  • Global Scope (The Stack): Because variable values cannot pass across function boundaries directly, developers must use the centralized data stack to share data. To create a global variable or pass values into a function scope, you must push the value onto the stack from the outer environment using sic em or dig up, and then pull it into the function environment using tug.

Syntax Reference

Wolf Esolang Syntax Reference
Command Syntax Action Type Functional Description
Mr. insert name here Start / Input Initializes program execution and prompts terminal input to store in the specified name variable.
howl name value Variable Instantiates a new memory variable with an initial value.
sic em value Push Pushes a specific numeric value or string literal onto the data stack.
dig up name Get Variable Retrieves the stored value of a variable and loads it onto the stack.
bark string Print Outputs data, text blocks, or variables directly to the standard display console.
chase down tail times Loop Implements a definite loop sequence running from 1 up to N times.
hybrid name (argument) Function Declares a named reusable execution procedure with custom inputs.
tug Pop Extracts and removes the top element from the active data stack.
bones value 1 value 2 Addition Takes two inputs, sums them together, and commits the result back to the stack.
squirrel value 1 value 2 Subtraction Deducts the second value from the first value and targets the stack with the result.
mailman value 1 value 2 Division Divides the first numeric asset by the second, committing the quotient to the stack.
fire hydrant value 1 value 2 Multiplication Computes the product of two targets and registers the final total on the stack.
fetch module Import Integrates an external script file or supplementary layout libraries into the program space.

Example Code

The following example demonstrates how to pass a variable into a hybrid (function) using the stack, circumventing the isolated scope restriction:

Mr. "PackLeader"
howl alpha 10

# alpha cannot be read inside functions, so we pass it via the global stack
dig up alpha 

hybrid run_calculation()
    # The function pulls alpha's value off the stack into its own local scope
    howl local_val tug
    fire hydrant local_val 5
    bark "Calculation finished!"

Where can I get this code????

To obtain the program, just go to the project’s codeberg page, download it and then the next steps depend on what type of project you are doing:


- If you want to make a full on script, go to a text editor and write you code, save it as a .wolf, then in terminal, type “python3 main.py *FILENAME*.wolf”

- If you want to mess around in an interpreter like the one in built into python, just go to your favirote terminal and type “python3 main.py” while in the directory