E q u a t i o n

From Esolang
Jump to navigation Jump to search

E q u a t i o n (formerly titled ComplexEquations) is an esoteric programming language where every aspect must be represented through an equation. The language is designed to handle simple arithmetic operations, emphasizing the use of equations for all variable definitions.

Variable Definitions

All variables in E q u a t i o n must begin as equations that are subsequently solved, reflecting the language's focus on arithmetic. There is one exception, however, and that is the URL (mentioned later on)

End Type Indicators

End type indicators are Unicode characters that signify the conclusion of a variable type. These characters serve as breakpoints between consecutive variables. Importantly, E q u a t i o n ONLY SUPPORTS THE UNICODE CHARACTERS THEMSELVES; escaping these characters is not permitted.

Spaces

Spaces are not allowed within equations. To represent a space, use the equation 31+1, which evaluates to ASCII 32 (the space character).

Language Structure

E q u a t i o n operates on a stack-based architecture, integrating the concept of stacks with variable management.

Variable Types

The language supports six types of pre-processor variable types. It is important to note that these variable types cannot be defined within the code itself.

Type Symbol(s) {Comma separated} Description
Int. Solves the attached equation, then sets the variable name to the result.
List ▓, ✤ Maintains a list of integers after solving equations left to right. This symbol is placed after each element, replacing ⁑ in that context. Lists are comma-separated and adhere to left-to-right order. Integers within a list are solved similarly to regular integers. ▓ serves as boundaries for the list, ✤ differentiates integers from lists, and ╗ is the end type indicator for a list (NOT A STRING).
String Converts solved integers to their ASCII counterparts after evaluating equations from left to right.
Null ↕, {�} Represents a null value. The unprintable character in {curly braces} is the null character (U+0000). Any usage of the null character will be similarly wrapped, requiring manual unwrapping. In contexts where Null is not displayed as a question mark box or diamond, ↕ can be used as an alias. The null end type indicator sets a variable to a null value, accepting no input.
Function ߣ Represents a function, which is more complex to explain as it involves concepts not yet introduced. Functions are wrapped in ▓, similar to lists. Arguments are defined using ⸨ ⸩.
URL 🌐 Retrieves an associated URL and is the only type in E q u a t i o n that utilizes plain text rather than equations.

Pre-Processor

The pre-processor serves as a data-dump located above the main program. It is initiated with the phrase "⊤⊥⊤⊥ PPI START ⊤⊥⊤⊥" and concludes with "⊤⊥⊤⊥ PPI END ⊤⊥⊤⊥". Within the pre-processor, variables, functions, and other definitions can be established, while the main code should be dedicated to calling functions and referencing variables.

Exception

There is one exception to the rule regarding the pre-processor: commands.

Commands

Commands in E q u a t i o n provide a method to invoke built-in functions without needing to define them manually. The syntax for calling a command is "{equation, no spaces}௺{arguments separated by comma};" (without quotes and without the curly braces). This format is referred to as a "command caller" and is compatible with both built-in and user-defined functions. The only exception to this is with conditionals, which have a distinct syntax.

Solution Expanded Command Name Argument(s) {if needed} Description
1 Print Last Thing in Stack N/A Outputs the last item from the stack.
2 Input N/A Prompts the user for a single character input.
3 Start Loop N/A Initiates a loop.
4 Stop Loop N/A Terminates the current loop.
5 Add Variable to Stack var name (1) Pushes the contents of the specified variable onto the stack.
6 Remove Stack N/A Clears the entire stack.
7 Get URL Contents Variable name Retrieves the contents of a specified URL and pushes it to the stack.
8 Open URL Variable name Opens the specified URL in the current web browser.

If Conditionals

If conditionals in E q u a t i o n are structured as follows: "Λ(condition without spaces)🟰(command caller)﹫(different command caller)". Here, Λ initiates the conditional, 🟰 represents the "true" command caller (the action to take if the condition is met), and ﹫ denotes the "false" command caller (the action to take if the condition is not met). The ﹫ part is mandatory.