-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# NETL2 Language Convention | ||
## Variables | ||
All variables in NETL2 should be in lower snake case. You cannot use reserved keywords as variable names. | ||
Additionally, variable identifiers cannot contain spaces, special characters, or numbers. | ||
|
||
Examples: | ||
```rs | ||
v var_name = 2 <- Recommended | ||
v varName = 2 <- Not recommended | ||
v varname = 2 <- Not recommended | ||
v var1 = 2 <- Does not work | ||
``` | ||
|
||
## Functions | ||
All functions in NETL2 should be in lower snake case. You cannot use reserved keywords as function names. | ||
Additionally, function identifiers cannot contain spaces, special characters, or numbers. | ||
|
||
Examples: | ||
```rs | ||
f main {} <- Recommended | ||
f main_function {} <- Recommended | ||
f Main {} <- Not recommended | ||
f mainFunction {} <- Not recommended | ||
f func1 {} <- Does not work | ||
``` | ||
|
||
## Comments | ||
Comments cannot be written at this time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Keywords in NETL2 | ||
- `v` - Declare a variable | ||
- `i` - Declare an if statement | ||
- `w` - Declare a while loop | ||
- `f` - Declare a function | ||
- `p` - Print a value | ||
|
||
# Expressions in NETL2 | ||
- `+` - Add two values | ||
- `-` - Subtract two values | ||
- `*` - Multiply two values | ||
- `/` - Divide two values | ||
- `==` - Check if two values are equal | ||
- `!=` - Check if two values are not equal | ||
- `>` - Check if the first value is greater than the second value | ||
- `<` - Check if the first value is less than the second value | ||
- `>=` - Check if the first value is greater than or equal to the second value | ||
- `<=` - Check if the first value is less than or equal to the second value | ||
- `&` - Check if both values are true | ||
- `|` - Check if either value is true | ||
- `!` - Check if the value is false | ||
|
||
# Types in NETL2 | ||
- `int` - Signed 32-bit integer | ||
- `str` - String | ||
- `bool` - Boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
v comp_one = 1 | ||
v comp_two = 2 | ||
v comp_three = 3 | ||
v comp_four = 3 | ||
|
||
i comp_one == comp_two | comp_three != comp_four { | ||
p("worked!") | ||
} | ||
p("done") | ||
i !false { | ||
p("true") | ||
} |