Dojo is a programming language that is loosely based off of the Python which uses the Python compiler and also uses it own Lexer, Parser, Compiler and Token Generator Some features of Dojo are as given below:
- Function declaration
- Variable Declaration
- Basic Arithmetic
- Executing Files
You can install dojo from the pip python package manager coming soon!!
You can install dojo from cURL through the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Japroz-Saini/dojo/master/install.sh)"
Basic Grammar of the DOJO Programming Language:
-
All keywords are in Capital
-
FUN = Used to declare a function
-
FOR = used to start a for loop
-
PRINT = return something to the screen
-
RETURN = return something
-
VAR = declare a variable
-
IF = if statement
-
ELIF = elif statement
-
ELSE = else statement
-
#
= Declare a comment -
A Function declaration
FUN greet(int, string)
FOR i = 0 TO int THEN
PRINT(string)
END
END
greet(10, "Hello from Dojo")
tokens = []
APPEND(tokens, "first_element")
# tokens/0 = "first_element"
# instead of tokens[i] you have to use tokens/i to access the i'th element
PRINT(tokens/0)
- Functions
FUN greet(string) -> PRINT(string)
- If else statements
IF a = True THEN
PRINT("TRUE")
ELIF a = False THEN
PRINT("FALSE")
ELSE THEN
- While statements
WHILE True THEN
PRINT("HELLO")
END
- Return statements
FUN greet() THEN
PRINT("HELLO")
RETURN "Hello"
END