User:PrySigneToFry/Sandbox/Draft of EtPL
- This is still a work in progress. It may be changed in the future.
Eternal Pratical Language is designed by PrySigneToFry in 2025, it is designed for all beginners to learn programming, like Bunnybell(or Bellbase). As an easy-to-understand and practical programming language, this language supports more convenient debugging and tracing. But actually, there's a certain irony about the language – ridiculing people who don't know how to code (I don't mean to offend anyone).
Purpose
For ease of use, we call it "EtPL", to disambiguition with "Easy programming language". EtPL is designed for strong functions/features, low difficulty, and for every computer-enthusiasts.
Language Overview
EtPL is Turing-complete, strong, convenient programming language that inspired from Python3 and Bunnybell(Bellbase).
Our first program
print("Hello, world!")
This prints the string Hello, world! to the console. Every program written outside a function, struct, class are treated as "<module>".
Syntax Overview
Statements
Statements are a single line of code that are interpreted to run a program. Each statement starts with a command, which can take arguments. The arguments for a command can be separated by tabs or spaces. A command may not receive any arguments. A command can also have arbitrary spaces and tabs before it.
command(*args, **kwargs)
A command even can be a keyword.
Statement blocks
Statement block are opened and closed by tags.
Open Close struct \struct function \function class \class macro \macro if end for end while end until end unless end
As you can see, definition statement block opening command with \ prefix becomes closing command, and if, for, while, until, unless are all ended with end.
Comments
# Single-line #* Multi-line*#
Value sort
Type: Boolean(False < True) < Number(-nan < -inf < ... < -2 < -1 < 0 < +1 < +2 < ... < +inf < +nan) < Complex(e. g., 3+4i < 5+12i because 5 < 13) < String < Tuple < Array < Set < Lambda.
Parentheses, Brackets, and Braces
Parentheses are used to change the priority of operations and to delimit tuple elements from external code. Square brackets are used for indexes and lists. Braces are used to delimit the collection element and the outer code, but not the two code blocks. Add M before opening bracket means a matrix.
Data types
- Numbers.
- Integer type. It has no range(range of the set Z).
- Float type. It has no range, either. Or, it has a range of the set R.
- Collections.
- Arrays. I don't want to speak nonsense.
- Matrices. A matrix with numbers.
- Strings. There are no "char" in EtPL, and it quoted in both double quote and single quote.
- Tuples. "Unchangable array", but (1, ) instead of (1).
- Sets. Automatically sort when inserted new element into set.
- Lambdas. A lambda expression.
- Nonetype. A null datum.
Sequential structure
Sequential structure means execute commands in the order we write.
# This calculates the area of the trapezoid. a = int(input()) b = int(input()) h = int(input()) print((a + b) * h / 2)
Conditional structure
As a conditional structure, the code must be able to determine whether or which piece of code needs to be executed based on a specific condition.
If statement
I really didn't want to talk nonsense, so I just threw the code here.
if condition: code #* else if condition: code else if... else: code *# end
Unless statement
unless condition: code #* else unless condition: code else unless... else: code *# end
This is same as:
if !condition: code #* else if !condition: code else if... else: code *# end
Loop structure
As a loop structure, this code must support the repeated execution of similar code with a specific condition.
Iterative loop
for iterator in container: code end
This statement executes similar code for all objects in the iteration container.
Conditional loop
While
while condition: code end
I don't want to speak nonsense.
Until
until condition: code end
This is equalvent to this:
while !condition: code end