Skip to content

Commit ba22c5a

Browse files
committed
done docs, made -h more helpfull
bumped version
1 parent c382f81 commit ba22c5a

File tree

6 files changed

+232
-127
lines changed

6 files changed

+232
-127
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "umpl"
3-
version = "1.0.0"
3+
version = "1.0.1"
44
edition = "2021"
55
license = "MIT"
66
repository = "https://github.com/mendelsshop/umpl"

Ideas.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Number interpolation ie:
2-
```
3-
23{7}4 # 2,374
4-
1{2.4}4 # 12.44
5-
22{3}4.4{3}5 # 2234.435
6-
```
1+
# Number interpolation i.e
2+
3+
```umpl
4+
(23{7}4)> ! 2,374
5+
(1{2.4}4)> ! 12.44
6+
(22{3}4.4{3}5)> ! 2234.435
7+
```

README.md

Lines changed: 127 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,156 @@
11

2-
# [![cargo clippy](https://github.com/mendelsshop/UMPL/actions/workflows/cargo_clippy.yml/badge.svg)](https://github.com/mendelsshop/UMPL/actions/workflows/cargo_clippy.yml)
2+
# [![cargo clippy](https://github.com/mendelsshop/UMPL/actions/workflows/cargo_clippy.yml/badge.svg)](https://github.com/mendelsshop/UMPL/actions/workflows/cargo_clippy.yml) [![crates.io](https://img.shields.io/crates/v/umpl.svg?label=latest%20version)](https://crates.io/crates/umpl) [![Crates.io](https://img.shields.io/crates/d/umpl?label=crates.io%20downloads)](https://crates.io/crates/umpl)
33

44
# UMPL
55

6-
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
77

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.
99

1010
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.
1111

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+
1224
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).
1325

14-
variables in UMPL must follow the kebab-case naming convention and have no uppercase letters.
26+
## IDE Support
1527

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)
1729

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
1931

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
40+
- `-e`: turns on evil mode
41+
42+
along with other dark secrets hidden in the code.
43+
44+
# language documentation
45+
46+
table of contents:
47+
48+
- [`Types`](##Types)
49+
- [`number`](###number)
50+
- [`string`](###string)
51+
- [`string escape sequences`](####string-escape-sequences)
52+
- [`boolean`](###boolean)
53+
- [`hempty`](###hempty)
54+
- [`file`](###file)
55+
- [`Declarations`](##Declarations)
56+
- [`Methods`](##Control-Flow)
57+
- [`Keywords`](##KEYWORDS)
2158

22-
# language-documentation
59+
## Types
60+
61+
### number
62+
63+
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.
2398

2499
## Declarations
25100

26101
| name | description | usage | special keywords | special variables | example(s) |
27102
|:---:|:---:|:---:|:---:|:---:|:---|
28103
| 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```|
29104
| 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))>⧽```|
31106

32-
## Control Flow
107+
## Control-Flow
33108

34109
|name|description|usage|special keywords| example(s) |
35110
|:---:|:---:|:---:|:---:|:---|
36-
| 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`)>⧽```|
37112
| loop statement | loop until the code reaches break of continue |loop ⧼code⧽ |break, continue| ```loop ⧼ if {true} ⧼(`true`)> break ⧽ else ⧼(`false`)> continue ⧽⧽```
38113

39114
## Keywords
40115

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
42117

43-
| name | description| paremeters | returns | example(s) |
118+
| name | description| parameters | returns | example(s) |
44119
| :-: | :-: | :-: | :-: | :- |
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 |
76-
|delete| deletes variable | [variable: variable] | hempty |
77-
|deletefile | deletes file | [file: file] | hempty |
78-
|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))>` |
140+
|error| errors with error message provided | [string: message] | hempty | `((error "error"))>` <br> `((error string-var))>` |
141+
|strtonum| converts string to number | [string: string] | number | ```((strtonum `5`))>``` <br> ```((strtonum `0x5`))>``` |
142+
|strtobool| converts string to boolean | [string: string] | boolean | ```((strtobool `true`))>``` <br> ```((strtobool `false`))>``` |
143+
|strtohempty| converts string to hempty | [string: string] | hempty | ```((strtohempty `empty`))>``` |
144+
|runcommand| runs os command | [string: command] | string | `((runcommand "ls"))>` |
145+
|open| opens file | [string: file] | file | `((open "file.txt"))>` |
146+
|close| closes file | [file: file] | hempty | `((close file-var))>` |
147+
|write| writes message to file with mode | [file: file, string: message, string: mode] | hempty | `((write file-var "message" "w"))>` <br> `((write file-var "message" "a"))>` |
148+
|writeline| writes message to file at line with mode | [file: file, string: message, number: line, string: mode] | hempty | `((writeline file-var "message" 1 "w"))>` <br> `((writeline file-var "message" 1 "a"))>` |
149+
|read| reads from file | [file: file] | string | `((read file-var))>` |
150+
|readline| reads the line specified from the file | [file: file, number: line] | string | `((readline file-var 1))>` |
151+
|delete| deletes variable | [variable: variable] | hempty | `((delete num-var))>` <br> `((delete str-var))>` |
152+
|deletefile | deletes file | [file: file] | hempty | `((deletefile file-var))>` |
153+
|createfile| creates new file | [string: file] | file | `((createfile "file.txt"))>` |
79154
|new| run custom function | function: name, arguments | whatever the function returns | ```((new 😀 3 5))>``` |
80155
|type | returns the type of the value | [any: value] | string | ```((type 1))>```|
81156

@@ -84,3 +159,8 @@ sometimes you can set a variable to two values for making list in lists
84159

85160
`*1`:
86161
one or more arguments
162+
163+
# Contributing
164+
165+
If you have any Ideas for the language put contribute them in [this file](https://github.com/mendelsshop/compiler/blob/main/Ideas.md)
166+
along with an example or two according of how to use it in the language.

0 commit comments

Comments
 (0)