You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have any Ideas for the language put contribute them in [this file](https://github.com/mendelsshop/compiler/blob/main/Ideas.md)
6
+
## About
7
7
8
-
along with an example or two according of how to use it in the language.
8
+
UMPL is a highly verbose, both c and lisp-like language.
9
9
10
10
With UMPL we stive to break backwards compatibility, so have fun trying to write the same code for different versions of the language, if this project even last long enough.
11
11
12
+
At UMPL to fix the null problem, we have invented a new type called hempty, which is the same as null, but it sounds better, and it adds to the long list of null like types across all the programming languages.
13
+
14
+
All bug reports head straight to /dev/hempty
15
+
16
+
## Case conventions
17
+
18
+
Variables in UMPL must follow the kebab-case naming convention and have no uppercase letters.
19
+
20
+
All internal keywords case depend on compiler options.
21
+
22
+
## Examples
23
+
12
24
To see example code for UMPL you can see [this directory](https://github.com/mendelsshop/UMPL/tree/main/umpl_examples), and to look at the formal language grammar refer to [this file](https://github.com/mendelsshop/UMPL/blob/main/grammer.md).
13
25
14
-
variables in UMPL must follow the kebab-case naming convention and have no uppercase letters.
26
+
## IDE Support
15
27
16
-
There is semi working vscode extension for UMPL, you can find it [here](https://github.com/mendelsshop/UMPL_VSCode_Extension)
28
+
There is semi working VSCode extension for UMPL, you can find it [here](https://github.com/mendelsshop/UMPL_VSCode_Extension)
17
29
18
-
At UMPL to fix the null problem, we have invented a new type called hempty, which is the same as null, but it sounds better, and it adds to the long list of null like types across all the proggraming languages.
30
+
## compiler options
19
31
20
-
All bug reports head straight to /dev/hempty
32
+
umpl [`File`][`Options`](###OPTIONS)]
33
+
34
+
### Options
35
+
36
+
-`-r, i`: start the REPL
37
+
-`-h`: print the help message
38
+
-`-t=<number>`: set the toggle case for keywords
39
+
-`-f`: put forceful mode on, useful for when you write a program via the REPL
Number is a hexadecimal floating point number, when shown to the user it will be in decimal.
64
+
valid examples: `0xa`, `0x14343.a1`, `10`, `10.1`
65
+
66
+
### string
67
+
68
+
String is a sequence of characters. string start and end with ``` ` ```.
69
+
70
+
#### string-escape-sequences
71
+
72
+
| Escape sequence | Description |
73
+
|:-:|:-:|
74
+
|`\n`| newline |
75
+
|`\t`| tab |
76
+
|`\r`| carriage return |
77
+
|`\b`| backspace |
78
+
|`\f`| form feed |
79
+
|`\a`| alert |
80
+
|`\v`| vertical tab |
81
+
|`\e`| escape |
82
+
|`\\`| backslash |
83
+
|```\` ```| single quote |
84
+
|```\x{hex}```| hexadecimal value in ascii representation |
85
+
|`\u{hex}`| Unicode character |
86
+
87
+
### boolean
88
+
89
+
Boolean is either true or false.
90
+
91
+
### hempty
92
+
93
+
Hempty is the same as null, but it sounds better.
94
+
95
+
### File
96
+
97
+
File is a path to a file.
23
98
24
99
## Declarations
25
100
26
101
| name | description | usage | special keywords | special variables | example(s) |
27
102
|:---:|:---:|:---:|:---:|:---:|:---|
28
103
| create | creates a variable | create var-name with literal or expression| N/A | N/A|```create num-var with 5``` <br> ```create str-var with ((input `>> `))>``` <br> ```create var with str-var```|
29
104
| list | creates a list | list var-name with [literal or expression literal or expression]| N/A | N/A|```list num-list with [1 3]```<br> ```list str-list with [8, ((input `>> `))]```|
30
-
| potato | declares a function | potato emoji-name num-of-args ⧼code⧽| return literal-or-expression| for each argument you get `$argument-number`ie`$1` for the first one etc |```potato 😀 2 ⧼return ((plus $1 $2))>⧽```|
105
+
| potato | declares a function | potato emoji-name num-of-arguments ⧼code⧽| return literal-or-expression| for each argument you get `$argument-number`i.e.`$1` for the first one etc.|```potato 😀 2 ⧼return ((plus $1 $2))>⧽```|
| if statement| if boolean is true do if code else do else code |if {boolean literal or expression} ⧼if code⧽ else ⧼else code⧽|N/A|```if {true} ⧼(`true`)>⧽ else ⧼(`false`)>⧽``` <br> ```if {not((true))>} ⧼(`true`)>⧽ else ⧼(`false`)>⧽``` <br> ```if {boolean-var} ⧼if {true} ⧼(`true`)>⧽ else ⧼(`false`)>⧽ ⧽ else ⧼(`false`)>⧽```|
111
+
| if statement| if boolean is true do if code else do else code |if {boolean: literal or expression} ⧼if code⧽ else ⧼else code⧽|N/A|```if {true} ⧼(`true`)>⧽ else ⧼(`false`)>⧽``` <br> ```if {not((true))>} ⧼(`true`)>⧽ else ⧼(`false`)>⧽``` <br> ```if {boolean-var} ⧼if {true} ⧼(`true`)>⧽ else ⧼(`false`)>⧽ ⧽ else ⧼(`false`)>⧽```|
37
112
| loop statement | loop until the code reaches break of continue |loop ⧼code⧽ |break, continue| ```loop ⧼ if {true} ⧼(`true`)> break ⧽ else ⧼(`false`)> continue ⧽⧽```
38
113
39
114
## Keywords
40
115
41
-
### To call a keyword you first need create an expression so ()> or ()>> or ()< and in the expression you put another pair of parentheses and the keyeword and its arguments
116
+
To call a keyword you first need create an expression so ()> or ()>> or ()< and in the expression you put another pair of parentheses and the keyword and its arguments
42
117
43
-
| name | description|paremeters| returns | example(s) |
118
+
| name | description|parameters| returns | example(s) |
44
119
| :-: | :-: | :-: | :-: | :- |
45
-
| plus | if the first argument is a number, returns the sum of all the arguments, if its a string, each argument after is conctenated to the string, anything else wont work | any*1: argument | any |
46
-
| minus| sets the first parameter to the original value each next argument is subtract to it unless there is one argument in which case it is negated returning the negative value of it | number*1: argument | number |
47
-
|multiply| if the first arguments is string, multiplies the string by the next argument, if its a number, sets the first parameter to the original value each next argument is multiplied to it, any other thing does not work | any*1: argument | any |
48
-
|divide| sets the first argument to the original value each next argument is divided by the previous divisor | number*1: argument | number |
49
-
|not| returns true if the value is false, false otherwise |[boolean: value]| boolean |
50
-
|or|comapares value1 and value2 and returns true if either is true |[boolean: value1, boolean: value2]| boolean |
51
-
|and|comapares value1 and value2 and returns true if both are true |[boolean: value1, boolean: value2]| boolean |
52
-
|eq| compare two values if they are equal |[boolean: value1, boolean: value2]| boolean |
53
-
|ne | compare two values if not equal |[boolean: value1, boolean: value2]| boolean |
54
-
|gt| checks if the number1 is greater than the number2 |[number: number1, number: number2]| boolean |
55
-
|lt| check if the number1 is less than the number2 |[number: number1, number: number2]| boolean |
56
-
|le| checks if the number1 is less than or equal to the right number2 |[number: number1, number: number2]| boolean |
57
-
|ge| check if the number1 is greater than or equal to the number2 |[number: number1, number: number2]| boolean |
58
-
|addwith| adds value to variable in place, if the variable is a string anything can added to it, but if its a number only number can, anything cannot be added to |[variable: variable, any: value]|number|
59
-
|dividewith| divides value by variable in place |[variable: variable, number: value]| number |
60
-
|subtractwith| subtracts value from variable in place |[variable: variable, number: value]| number |
61
-
|multiplywith| multiplies value by variable in place, if variable is a string than the variable becomes the string value times, if the variable is a number we multiply the variable by the value, any other variable wont work |[variable: variable, number: value]|number|
62
-
|input| input with message |[string: message]| string |
63
-
|setwith| sets a variable to a value |[variable: variable , value*: any]| any |
64
-
|exit| exits with number provided |[number: number]| hempty |
65
-
|error| errors with error message provided |[string: message]| hempty |
66
-
|strtonum| converts string to number |[string: string]| number |
67
-
|strtobool| converts string to boolean |[string: string]| boolean |
68
-
|strtohempty| converts string to hempty |[string: string]| hempty |
69
-
|runcommand| runs os command |[string: command]| string |
70
-
|open| opens file |[string: file]| file |
71
-
|close| closes file |[file: file]| hempty |
72
-
|write| writes message to file with mode |[file: file, string: message, string: mode]| hempty |
73
-
|writeline| writes message to file at line with mode |[file: file, string: message, number: line, string: mode]| hempty |
74
-
|read| reads from file |[file: file]| string |
75
-
|readline| reads the line specified from the file |[file: file, number: line]| string |
|createfile| creates new file |[file: file]| file |
120
+
| plus | if the first argument is a number, returns the sum of all the arguments, if its a string, each argument after is concatenated to the string, anything else wont work | any*1: argument | any|`((plus 5 6 7))>` <br> ```((plus `s` true 7))>```|
121
+
| minus| sets the first parameter to the original value each next argument is subtract to it unless there is one argument in which case it is negated returning the negative value of it | number*1: argument | number |`((minus 5 6 7))>` <br> ```((minus 1))>```|
122
+
|multiply| if the first arguments is string, multiplies the string by the next argument, if its a number, sets the first parameter to the original value each next argument is multiplied to it, any other thing does not work | any*1: argument | any |`((multiply 5 6 7))>` <br> ```((multiply `s` 7))>```|
123
+
|divide| sets the first argument to the original value each next argument is divided by the previous divisor | number*1: argument | number |`((divide 5 6 7 3))>` <br> ```((divide 1))>```
124
+
|not| returns true if the value is false, false otherwise |[boolean: value]| boolean |`((not true))>` <br> `((not boolean-var))>`|
125
+
|or|compares value1 and value2 and returns true if either is true |[boolean: value1, boolean: value2]| boolean|`((or true false))>` <br> `((or boolean-var boolean-var-1))>`|
126
+
|and|compares value1 and value2 and returns true if both are true |[boolean: value1, boolean: value2]| boolean|`((and true false))>` <br> `((and boolean-var boolean-var-1))>`|
127
+
|eq| compare two values if they are equal |[any: value1, any: value2]| boolean|`((eq true false))>` <br> ```((eq `t` string-var))>````((eq 5 6))>`|
128
+
|ne | compare two values if not equal |[any: value1, any: value2]| boolean|`((ne true false))>` <br> ```((ne `t` string-var))>```|
129
+
|gt| checks if the number1 is greater than the number2 |[number: number1, number: number2]| boolean |`((gt 5 6))>`|
130
+
|lt| check if the number1 is less than the number2 |[number: number1, number: number2]| boolean |`((lt 5 6))>`|
131
+
|le| checks if the number1 is less than or equal to the right number2 |[number: number1, number: number2]| boolean |`((le 5 6))>`|
132
+
|ge| check if the number1 is greater than or equal to the number2 |[number: number1, number: number2]| boolean |`((ge 5 6))>`|
133
+
|addwith| adds value to variable in place, if the variable is a string anything can added to it, but if its a number only number can, anything cannot be added to |[variable: variable, any: value]|any |`((addwith num-var 5))>` <br> ```((addwith str-var `s`))>``` <br >```((addwith str-var 5))>```|
134
+
|subtractwith| subtracts value from variable in place |[variable: variable, number: value]| number|`((subtractwith num-var 5))>`|
135
+
|dividewith| divides value by variable in place |[variable: variable, number: value]| number|`((dividewith num-var 5))>`|
136
+
|multiplywith| multiplies value by variable in place, if variable is a string than the variable becomes the string value times, if the variable is a number we multiply the variable by the value, any other variable wont work |[variable: variable, number: value]|any |`((multiplywith num-var 5))>` <br> ```((multiplywith str-var 5))>```|
137
+
|input| input with message |[string: message]| string |`((input "enter your name"))>` <br> `((input string-var))>`|
138
+
|setwith| sets a variable to a value |[variable: variable , value*: any]| any |`((setwith num-var 5))>` <br> ```((setwith str-var `s`))>```|
139
+
|exit| exits with number provided |[number: number]| hempty |`((exit 5))>`|
0 commit comments