ENIDE Language
ENIDE is a programming language designed to be written in any human language. The same program can be written in English, Portuguese, French, or any other supported language — only the keywords change, never the structure.
All examples in this documentation use English.
The exact same patterns apply in every other supported language —
replace the keywords with their translated equivalents using
enide [language]-d.
Tutorial
Installation
After installing ENIDE, get ready your setup with four quick steps.
Check the version
v0.0.0
Find your language
ENIDE supports dozens of human languages. List them all to find yours.
Get help of commands by your language
Replace english with your language name to see
all available commands.
Get all the keywords functions by your language
Replace english with your language name to see
all the keywords functions by your language.
Get internal documentation by your language
Replace english with your language name to see
the documentation by your language.
It's recommended run this command on visual studio code terminal enide [language]-d.
For the better view of this command output.
Install "enide-dev" our official visual studio code extension (recommended)
"enide-dev" is supported with: Syntax highlighting , Run button and enide icon in .nd files .
First Program
Every ENIDE file must start with an
#include declaration this keyword must be by your your language.
After that, write your program, Replace english with your language name and run it.
Hello, world!
.nd#include<english.lang>;
print("Hello, world!");
#include is required for all enide program.
It stays if you don't include #include in your program.
The ENIDE interpreter will not get all the keywords by your language.
Code and commands with UTF-8 charset support
By default code and commands are not supported with UTF-8 charset characters.
So to set the UTF-8 charset in all run you must add the parameter utf-8
in end of command.
Command
utf-8 parameter can be used in other command that is intended receive UTF-8 output.
Code
utf-8 parameter can be used to run a enide code, that was written with UTF-8 characters
Hello, world!
.nd#incluir<português.lang>;
função oláMundo() {
escreva("Olá, mundo!");
}
oláMundo();
Includes
Includes load a language pack or a library. They must appear at the top of the file, before any other code.
Syntax
.nd#include<name.extension>;
| Extension | Purpose | Example |
|---|---|---|
| .lang | Language pack — required in every file | #include<english.lang>; |
| .lib | Standard library (math, date, etc.) | #include<math.lib>; |
| .nd | Import all the data structure and functions from this file | #include<./greet.nd>; |
All the module path came from main file that is been running.
.nd#include<english.lang>;
#include<math.lib>;
#include<greet.nd>;
greet.hi();
print(Sqrt(144)); /* 12 */
All file include is accessed as object from the filename.
if it's #include<person.nd>; to acess the variable string name = "euclides";
on this file we are going to call it as a object. person.name;
Data Types
ENIDE has five types. Every variable must be declared with a type and must always be initialised — declaration without a value is not allowed.
Variables
Declaration and assignment
.nd#include<english.lang>;
string name = "claudio";
number age = 16;
bool adult = false;
print("I am", name, "and I am", age, "years old");
Updating a variable
.nd#include<english.lang>;
number score;
score:number = 10; /* assign */
score:number += 5; /* add */
score:number -= 2; /* subtract */
score:number *= 3; /* multiply */
score:number /= 2; /* divide */
score:number %= 4; /* remainder */
print(score); /* 3.5 */
Arrays
An array holds an ordered list of values. Declare with
[] and access elements by index starting at
0.
.nd#include<english.lang>;
/* Declare with initial values */
string fruits = ["apple", "banana", "cherry"];
/* Declare empty, fill later */
number scores = [];
for(number i = 0, i < 3, i++) {
print("Enter score", i + 1, ":");
scan(number, scores[i]);
}
/* Access by index */
print(fruits[0]); /* apple */
print(scores[2]); /* third score */
Is not supported object in array.
Writing string persons = [{...}]; is a syntax error.
Objects
An object groups related variables under a single name. Access properties with a dot.
.nd#include<english.lang>;
object person = {
string name = "claudio";
number age = 16;
bool adult = false;
string langs = ["pt", "en"];
}
print("Name:", person.name);
print("Age:", person.age);
print("Adult:", person.adult);
Class
Atributes and methods
.nd#include<english.lang>;
class Person {
constructor {
public string name;
private number age;
}
function isAdult() {
return(self.age >= 18);
}
}
object me = new Person("claudio", 17);
| Block | Description |
|---|---|
| constructor | structure that allow declare atributes in a class |
| function | Allow declare methods in a class |
Acess modifiers
| Command | Description |
|---|---|
| public | accessible from anywhere |
| private | accessible only within the class |
| readonly | value can only be assigned once |
| static | belongs to the class itself, not to instances |
Conditionals
if / else if / else
.nd#include<english.lang>;
number score = 72;
if(score >= 90) {
print("Grade: A");
} else if(score >= 75) {
print("Grade: B");
} else if(score >= 60) {
print("Grade: C");
} else {
print("Grade: F");
}
Switch / Case
Use switch when testing a single variable against
multiple exact values. default runs when no case
matches.
.nd#include<english.lang>;
number day = 3;
switch(day) {
case(1) { print("Monday"); }
case(2) { print("Tuesday"); }
case(3) { print("Wednesday"); }
case(4) { print("Thursday"); }
case(5) { print("Friday"); }
case(6) { print("Saturday"); }
case(7) { print("Sunday"); }
default { print("Invalid Day of the week"); }
}
| Block | When it runs |
|---|---|
| case | if controlling expression match with the parameter passed will run, the case block code |
| default | Run the block if controlling expression does not match with any case. |
Loops
for— known number of iterations
The for loop takes three arguments:
initialisation, condition, and
update, separated by commas.
.nd#include<english.lang>;
for(number i = 1, i <= 5, i++) {
print(i);
}
/* Output: 1 2 3 4 5 */
while — condition-based iteration
Use while when the number of iterations is not known in
advance.
.nd#include<english.lang>;
number index = 0;
while(index < 5) {
print(index);
index:number += 1;
}
/* Output: 0 1 2 3 4 */
Always make sure the loop condition eventually becomes
false. Forgetting to update the counter (e.g.
index += 1) creates an infinite loop.
Exceptions
Use try / catch / finally to handle runtime errors
gracefully. The finally block always runs, even if an
error occurred.
.nd#include<english.lang>;
try {
print("Trying...");
/* code that might fail */
} catch {
print("Something went wrong.");
} finally {
print("This always runs.");
}
| Block | When it runs |
|---|---|
| try | Always — contains the code to attempt |
| catch | Only when an error occurs inside try |
| finally | Always — regardless of success or failure |
Functions
Functions group reusable logic under a name. Parameters are declared
with their types, and functions can return a value with
return.
Function without return value
.nd#include<english.lang>;
function greet(string name, number age) {
print("Hi, I am", name, "and I am", age, "years old");
}
greet("claudio", 16);
greet("euclides", 29);
Function with return value
.nd#include<english.lang>;
function add(number a, number b) {
return(a + b);
}
function isAdult(number age) {
return(age >= 18);
}
print(add(3, 7)); /* 10 */
print(isAdult(16)); /* false */
print(isAdult(29)); /* true */
Libraries
Libraries extend ENIDE with additional functions. Include them at the top of your file alongside the language pack.
math.lib
.nd#include<english.lang>;
#include<math.lib>;
print(Sqrt(100)); /* 10 */
print(Max(4, 9)); /* 9 */
print(Min(4, 9)); /* 4 */
print(PI); /* 3.14159... */
Use enide english-d (or your language) in the
terminal to see the full list of available functions for each
library.
Operators
Arithmetic
| Operator | Meaning |
|---|---|
| + | Addition |
| - | Subtraction |
| * | Multiplication |
| / | Division |
| % | Remainder (modulo) |
| ** | Exponentiation |
| ++ | Increment by 1 |
| -- | Decrement by 1 |
Comparison
| Operator | Meaning |
|---|---|
| === | Equal with the same type |
| == | Equal |
| != | Not equal |
| !== | Strict not equal |
| > | Greater than |
| < | Less than |
| >= | Greater or equal |
| <= | Less or equal |
Logical
| Operator | Meaning | Example |
|---|---|---|
| && | AND — both must be true | age > 0 && age < 120 |
| || | OR — at least one must be true | x == 0 || x == 1 |
| ! | NOT — inverts the value | !adult |
CLI Commands
All ENIDE functionality is accessible from the terminal. Replace
english with your language name where applicable.
| Command | Description |
|---|---|
| enide version | Show the installed ENIDE version |
| enide languages | List all supported human languages |
| enide file.nd | Execute an ENIDE program |
| enide english-h | Show all commands translated to English |
| enide english-g | Show full keywords functions |
| enide english-d | Show full translated documentation |
The suffix -h and -d follow the
language name. For Portuguese it would be
enide portugues-h; for Spanish,
enide espanol-h.