https://github.com/japrozs/dojo
Dojo is a microlanguage based off of Python.It has many features like function declaration and variable declaration
https://github.com/japrozs/dojo
arithmetic compiler dojo functions language lexer microlanguage parse parser python semver variables
Last synced: over 1 year ago
JSON representation
Dojo is a microlanguage based off of Python.It has many features like function declaration and variable declaration
- Host: GitHub
- URL: https://github.com/japrozs/dojo
- Owner: japrozs
- License: mit
- Created: 2020-09-18T16:29:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-19T20:47:42.000Z (over 5 years ago)
- Last Synced: 2025-01-09T01:04:25.501Z (over 1 year ago)
- Topics: arithmetic, compiler, dojo, functions, language, lexer, microlanguage, parse, parser, python, semver, variables
- Language: Python
- Homepage: https://github.com/Japroz-Saini/dojo
- Size: 92.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Dojo
Dojo is a programming language that is loosely based off of the [Python](https://python.org) 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
# Install
You can install dojo from the pip python package manager coming soon!!
## Curl
You can install dojo from cURL through the following command:
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Japroz-Saini/dojo/master/install.sh)"
```
# Grammar
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
```python
FUN greet(int, string)
FOR i = 0 TO int THEN
PRINT(string)
END
END
greet(10, "Hello from Dojo")
```
```python
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)
```
# Single line:
* Functions
```python
FUN greet(string) -> PRINT(string)
```
* If else statements
```python
IF a = True THEN
PRINT("TRUE")
ELIF a = False THEN
PRINT("FALSE")
ELSE THEN
```
* While statements
```python
WHILE True THEN
PRINT("HELLO")
END
```
* Return statements
```python
FUN greet() THEN
PRINT("HELLO")
RETURN "Hello"
END
```