User:Gilbert189/An Esolang about Declaring Statements
- This article is just a draft. See User:Gilbert189#Drafts for more info.
An Esolang about Declaring Statements is an esolang about declaring statements. This esolang about declaring statements is made by User:Gilbert189.
Warm-up
Here's a line in Gilbert189/An Esolang about Declaring Statements:
Integer foo is NumberLiteral that has 1.
I don't need to explain what it does. You can figure it out yourself.
Comments
There's two ways to add comments in An Esolang about Declaring Statements:
Ignore this: Method "print line" has a StringLiteral that has T, e, s, and t. Note that the line above is ignored.
You can guess when you should which commenting style.
Should the compiler found the Ignore this:
line, a warning will be emitted telling the programmer that such lines may clutter the source code.
Documentation
Codes may be documented like these:
About this variable: This sets the width of the window that will be created by the "makeWindow" function. Integer windowWidth is NumberLiteral that has 640. About this variable: This sets the height of the window that will be created by the "makeWindow" function. Integer windowHeight is NumberLiteral that has 480. About this function: This function creates a window with the dimensions set by the `windowWidth` and `windowHeight` variables. Function (that returns Integer) "makeWindow" is CodeLiteral that has the following: ... That sums out the CodeLiteral.
Datatypes
Here are the datatypes of An Esolang about Declaring Statements:
Integer
: Stores a 32-bit integer.LittleInteger
: Stores a 16-bit integer.LongInteger
: Stores a 64-bit integer.BigInteger
: Stores an arbitary-sized integer.UnsignedInteger
: Stores an unsigned 32-bit integer.UnsignedLittleInteger
: Stores an unsigned 16-bit integer.UnsignedLongInteger
: Stores an unsigned 64-bit integer.UnsignedBigInteger
: Stores an unsigned arbitary-sized integer.FloatingPoint
: Stores a 32-bit floating point number.LongFloatingPoint
: Stores a 64-bit floating point number.BigFloatingPoint
: Stores an arbitrary-precision floating point number.FixedPoint
: Stores a fixed point number.String
: Stores a string.Collection
: Stores a collection of data.Function
: Stores a function.Method
: Stores a method. (functions that don't return)
Classes
Classes are groups of datatypes that share some of their functionality. Such classes include:
Number
: Includes number types.Integers
: Includes integer types.FloatingPoints
: Includes floating point number types.BigNumber
: Includes arbitrary-size number types.
Callable
: Includes callable types.
Function
and Method
All functions in An Esolang about Declaring Statements are monadic (i.e., it only accepts one input), and is stored on the function as the variable input
.
The compiler should be smart enough to infer the input type from the function.
If you want more inputs, you can use Collection
.
To return a function, you can use make
:
Function (that returns Integer) "test" is CodeLiteral that has the following: Integer input is defined. ... Function "test" makes Integer foo. That sums out the CodeLiteral.
You can change makes
into its past form (made
)
To call a function, you can use stores
, and given
:
Function (that returns Integer) "test" stores Integer "result" given NumberLiteral that has 1.
Built-in Method
s
The built-in Method
s of Gilbert189/An Esolang about Declaring Statements are:
Name | Input | Description |
---|---|---|
"if" |
DataCollection (that contains Function (that returns Boolean), and CodeLiteral) |
If statement. |
"while" |
DataCollection (that contains Function (that returns Boolean), and CodeLiteral) |
While statement. |
"print line" |
Anything |
Prints the given input at a new line. |
"print" |
Anything |
Prints the given input. |
"isolate" |
CodeLiteral |
Execute in an isolated environment. |
Built-in Function
s
The built-in Function
s of Gilbert189/An Esolang about Declaring Statements are:
Name | Input | Returns | Notes |
---|---|---|---|
"add" |
DataCollection (that contains any number of Number) |
The sum of all the numbers. | |
"subtract" |
DataCollection (that contains any number of Number) |
The difference of all the numbers, in order. | |
"multiply" |
DataCollection (that contains any number of Number) |
The product of all the numbers. | |
"divide" |
DataCollection (that contains any number of Number) |
The quotient of all the numbers, in order. |
Literals
Each datatype requires a literal.[1] Here are the literals of An Esolang about Declaring Statements:
NumberLiteral
is a literal for theInteger
, andFloatingPoint
families.StringLiteral
is a literal forString
.CodeLiteral
is a literal forFunction
, andMethod
.DataCollection
is a literal forCollection
.Nothing
is a null literal.
To put values, you can use that has
. For example:
NumberLiteral that has 12
You can also:
- change
has
tois
orreturns
. - exclude
that
.
List
A list is a special literal that consists of a list of other literals, including other lists. They can be written with each items at seperate lines:
DataCollection that has the following: NumberLiteral that has 69. NumberLiteral that has 420. That sums out the DataCollection.
or condensed as a one-liner:
DataCollection that has NumberLiteral that has 12, and NumberLiteral that has 12.
Note that you cannot make nested lists on a one-line list.
CodeLiteral
and DataCollection
These datatypes accept a list as a literal.
DataCollection that has the following: NumberLiteral that has 12. NumberLiteral that has 12. That sums out the DataCollection. CodeLiteral that has the following: Integer foo is NumberLiteral that has 1. That sums out the CodeLiteral.
You can also:
- change
the following
tothis list of literals
orthis lines of code
forCodeLiteral
. - change
sums out
toconcludes
oris for
. - exclude
the
at the end of the list.
When specifying a DataCollection
as a
StringLiteral
You can set up StringLiteral
character by character using a list. For example:
StringLiteral that has T, e, s, and t.
For miscellaneous symbols (like comma), you can use it's Unicode name:
StringLiteral that has HIRAGANA LETTER KO, HIRAGANA LETTER N, HIRAGANA LETTER NI, HIRAGANA LETTER TI, HIRAGANA LETTER HA, FULLWIDTH EXCLAMATION MARK.
Errors
Error messages in An Esolang about Declaring Statements must be polite, official, and descriptive, with detailed explanation on the error and how to fix it.
Here's an example error message of An Esolang about Declaring Statements.
I found an error at line 1, column 46, as shown below: 1 | String "foo" is StringLiteral that has T, e, s and t. ^ For easier parsing, An Esolang about Declaring Statements respects the Oxford comma, and thus rejects this statement due to this syntax error. To resolve this error, please add a comma for every item on a list, including ones that is prefixed with "and". *** I found something wrong at lines 32 to 34, as shown below: 32 | (some line...) 33 | (some line...) 34 | (some line...) It seems like your code at this point is unreachable. Please rewrite your code to correct this. Alternatively, you can make me ignore this error by giving me the command-line argument --ignore=UnreachableCodeWarning. ... *** Compilation failed! 27 errors found, 63 warnings emitted. Please evaluate the errors as a reference to revise your source code.
An optional, computer-readable error message may be implemented as well (and it may not use YAML, but using one is recommended):
ParserError: - OxfordCommaExclusionError: Line: 1 Column: 46 - UnreachableCodeWarning: Lines: [32, 34] # ... --- Success: No Errors: 27 Warnings: 63
Examples
"Hello, world!" program:
Method "print line" has a StringLiteral that has H, and e, and l, and l, and o, and COMMA, and SPACE, and w, and o, and r, and l, and d, and EXCLAMATION MARK.
FizzBuzz
Integer i is NumberLiteral that has 1. Method "while" has a DataCollection that has the following: Function (that returns Boolean) that has CodeLiteral that has the following: Function (that returns Boolean) "lessThan" stores Boolean "result" given a DataCollection that has the following: Integer i. NumberLiteral that has 1. That sums out the DataCollection. Function makes Boolean "result". That sums out the CodeLiteral. CodeLiteral that has the following: String out is Nothing. Method "if" has a DataCollection that has the following: Function (that returns Boolean) "lessThan" has a DataCollection that has the following: Function (that returns Integer) "mod" has a DataCollection that has the following: Integer i. NumberLiteral that has 3. That sums out the DataCollection. NumberLiteral that has 0. That sums out the DataCollection. CodeLiteral that has the following: String out is Function (that returns String) "join" that has a DataCollection that has the following: String out. StringLiteral that has F, i, z, and z. That sums out the DataCollection. That sums out the CodeLiteral. That sums out the DataCollection. Method "if" has a DataCollection that has the following: Function (that returns Boolean) "lessThan" has a DataCollection that has the following: Function (that returns Integer) "mod" has a DataCollection that has the following: Integer i. NumberLiteral that has 5. That sums out the DataCollection. NumberLiteral that has 0. That sums out the DataCollection. CodeLiteral that has the following: String out is Function (that returns String) "join" that has a DataCollection that has the following: String out. StringLiteral that has B, u, z, and z. That sums out the DataCollection. That sums out the CodeLiteral. That sums out the DataCollection. Method "if" has a DataCollection that has the following: Function (that returns Boolean) "equal" has a DataCollection that has the following: String out. Nothing. That sums out the DataCollection. CodeLiteral that has the following: String out is Function (that returns String) "join" that has a DataCollection that has the following: String out. Integer i. That sums out the DataCollection. That sums out the CodeLiteral. That sums out the DataCollection. Method "print line" has a String out. Method "increment" has Integer i. That sums out the CodeLiteral. That sums out the DataCollection.
- ↑ There's a special keyword
defined
which only defines the variable without a literal, but doing anything with it is undefined behaviour until it's defined by a literal.