| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| self.cpp | 2020-11-02 | 18.6 kB | |
| data.cpp | 2020-11-02 | 357 Bytes | |
| language.cpp | 2020-11-02 | 20.2 kB | |
| main.cpp | 2020-11-02 | 1.9 kB | |
| parsley | 2020-11-02 | 584.5 kB | |
| README.md | 2020-11-02 | 6.6 kB | |
| LICENSE | 2020-11-02 | 18.4 kB | |
| Totals: 7 Items | 650.7 kB | 0 |
Parsley
Parsley is a programming language. It is simple, and straightforward.
Features of Parsley
- Simple Syntax
- Easy to read code
- Non-confusing commands
Tutorial
Syntax
Using these symbols for:
- <> : Required to write it. (You don't need to write the bracket.)
- [] : Optional option. (You don't need to write the bracket.)
- | : A or B.
- Example:
<1|0>: Required to write 1 or 0.
- Example:
- ~ : A to B.
- Example:
<0~9>: Required to write 0~9.
- Example:
- + : Repeat than one.
- () : Grouping. (You don't need to write the bracket.)
- # : Type.
- Example:
<any>#String
- Example:
-
- : Comment. (You don't need to write it.)
- Example:
<any>#String*Op*
- any : Any values.
Syntax rules:
- Use one letter alpahbet for select types
- Example:
s
- Example:
- Use
"for put,to content- Example:
s"Hello, world!"
- Example:
- Use
,for arguments.- Example:
SCALL:sPUSH,n0
- Example:
One letter alphabet for something
s<any>: String.n<(0~9)+>: Number.u<any>: Convert hex to string.N: Nil.b<1|0>: Bool.%<0~9>: Access to data list.$<any>: Access to variable.
Commands
- REM / ;
Description: Comment.
Example:
1. `;Comment`
2. `REM:Comment`
- <$ / $>
Description: Multiline comment.
Note: It must be multiline.
Example:
- ```
<$
Comment
$>
```
Description: Prints to the console without newline.
Usage: PRINT:<any>
Example:
- ```
PRINT:sHello
```
- PRINTLN
Description: Prints to the console with newline.
Usage: PRINTLN:<any>
Example:
- ```
PRINTLN:sHello
```
- DCALL
Description: Controls the data list.
Usage: `DCALL:<any>#StringOperator, it must be PUSH or POP,[any]*It is for PUSH op only
Example:
1. ```
DCALL:sPUSH,n1
```
2. ```
DCALL:sPOP
```
- DEF
Description: Defines the variable.
Usage: DEF:<any>*Variable name*,<any>*Variable content*
Example:
- ```
DEF:sA,n0
```
- INPUT
Description: Get string from STDIN, and put string to data list.
Usage: INPUT
Example:
- ```
INPUT
```
- EXIT
Description: Exits from program.
Usage: EXIT:<any>#Number*Exit code*
Example:
- ```
EXIT:n1
```
- ADD / SUB / MUL / DIV / MOD Description: Calculates the 2 numbers.
Usage: OP:<any>#Number,<any>#Number
Note: It does 1st argument OP 2nd argument.
Example:
- ```
DIV:n3,n2
```
- JUMP
Description: Jumps to the another line.
Usage: JUMP:<any>#Number
Example:
- ```
JUMP:n1
```
- LCALL
Description: Controls the labels.
Usage: LCALL:<any>#String*Operator, it must be DEF or JUMP*,<any>*Label name*<any>
Example:
1. ```
LCALL:sDEF,sLabel1
```
2. ```
LCALL:sJUMP,sLabel1
```
- _INFO
Description: Sees infos.
Usage: _INFO
- OP
Description: Compare the 2 values, and put result to data list.
Usage: OP:<any>#String*Any operator, see list*,<any>,<any>
Operators:
- EQ
If the 2 values' datas are same then, return 1.
- !EQ
If the 2 values' datas aren't same then, return 1.
- EQ!
If the 2 values are same then, return 1.
- !EQ!
If the 2 values aren't same then, return 1.
- GT (Greater Than)
- LT (Lesser Than)
- GE (Greater than or Equal)
- LE (Lesser than or Equal)
Example:
- ```
OP:sEQ!,n0,s0
```
- SLEEP
Description: Stops the program.
Usage: SLEEP:<any>#Number*Milliseconds*
Example:
- ```
SLEEP:n1000
```
- ERR
Description: Outputs the error.
Usage: ERR:<any>*Error content*,[any]#Number*Exit code*
Example:
- ```
ERR:s"Fatal error!",n132
```
- BEGIN / END
Description: Defines function.
Usage of BEGIN: BEGIN:<any>*Name of function*
Usage of END: END
Example:
- ```
BEGIN:sHello
PRINTLN:s"Hello!"
END
```
- CALL
Description: Calls function.
Usage: CALL:<any>*Name of function*
Example:
- ```
CALL:sHello
```
- POW
Description: Does POW(x,y).
Usage: POW:<any>#Number,<any>#Number
Example:
- ```
POW:n-1,n5
```
- LOAD
Description: Loads other program.
Usage: LOAD:<any>
Example:
- ```
LOAD:s"useful.psy"
```
- CCALL
Description: Calls function if bool is true.
Usage: CCALL:<any>#Bool,<any>*Name of function*
Example:
- ```
CCALL:b0,sFunc
```
- CONCAT
Description: Concats two values.
Usage: CONCAT:<any>,<any>
Example:
- ```
CONCAT:s"Hello, ",s"world!"
```
- FLOOR
Description: Does FLOOR(x).
Usage: FLOOR:<any>#Number
Example:
- ```
FLOOR:n3.14
```
- NTOI
Description: Converts Number to integer string.
Usage: NTOI:<any>#Number
Example:
- ```
NTOI:n3.14
```
- NTOS
Description: Converts Number to String.
Usage: NTOS:<any>#Number
Example:
- ```
NTOS:n3.14
```
- FREAD
Description: Reads file content.
Usage: FREAD:<any>
Example:
- ```
FREAD:smain.psy
```
- FWRITE
Description: Writes to file.
Usage: FWRITE:<any>*Filename*,<any>*Content*
Example:
- ```
FWRITE:stest,sTest!
```
- FEXIST
Description: Checks does file exist.
Usage: FEXIST:<any>
Example:
- ```
FEXIST:s"main.psy"
```
- RANDOM
Description: Generate random number in 0 - 1.
Usage: RANDOM
Example:
- ```
RANDOM
```
- IF / ENDIF
Description: If statement.
Usage of IF: IF:<any>*Op, same with OP*,<any>,<any>
Usage of ENDIF: ENDIF
Example:
- ```
IF:sEQ,n0,n1
PRINTLN:s"Hmm, why 0 and 1 are same?"
ENDIF
```
- GET
Description: Gets value from Variable / Data list.
Usage: GET:<any>*VARiable(VAR) or Data List(DL)*,<any>*Variable name or Data list's index*
Example:
- ```
GET:sVAR,sline
```