-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcfg.txt
36 lines (36 loc) · 1.84 KB
/
cfg.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
S -> S S | VAR = VARVAL | VAR += VARVAL | VAR -= VARVAL | VAR *= VARVAL | VAR /= VARVAL | IF S | PRINT | WHILE S| FOR S| DEF S RETURN | CLASS S | IMPORT | FROM | COMMENT | VAR INBRACKET | VAR = VAR INBRACKET | METHOD | WITH S | PASS | RAISE;
VARVAL -> VAR | VAL | VARVAL OPERATOR VARVAL | INPUT | VARVAL , VARVAL | METHOD | NONE;
OPERATOR -> + | - | * | / | %;
VAR -> variable;
VAL -> angka | VARVAL OPERATOR VARVAL | VARVAL ** VARVAL | VARVAL // VARVAL | ( VARVAL ) | BOOLEAN | ' STRING '| " STRING " | [ VARVAL ] | { VARVAL } |[ ] | { } | " " | ' ' ;
EVALUATOR -> > | < | = = | ! = | < = | > = ;
STRING -> string | STRING STRING;
BOOLEAN -> True | False | BOOLEAN and BOOLEAN | BOOLEAN or BOOLEAN | not BOOLEAN | VARVAL is VARVAL | VARVAL EVALUATOR VARVAL;
COMMENT -> TRIPLESINGLEQUOTEOPEN STRING TRIPLESINGLEQUOTECLOSE | TRIPLEDOUBLEQUOTEOPEN STRING TRIPLEDOUBLEQUOTECLOSE | # STRING;
TRIPLEDOUBLEQUOTEOPEN -> " " " STRING | " " " ;
TRIPLEDOUBLEQUOTECLOSE -> " " " | STRING " " " ;
TRIPLESINGLEQUOTEOPEN -> ' ' ' STRING | ' ' ' ;
TRIPLESINGLEQUOTECLOSE -> ' ' ' | STRING ' ' ' ;
INBRACKET -> ( METHOD ) | ( VARVAL ) | ( ) | ( STRING ) ;
EXPRES -> ( BOOLEAN ) | BOOLEAN | INBRACKET;
RAISE -> raise METHOD ;
BREAK -> break;
PASS -> pass;
PRINT -> print INBRACKET;
CONTINUE -> continue;
ELSE -> else : ;
IF -> if EXPRES :| IF S ELIF S| IF S ELSE S| IF S RAISE ;
ELIF -> elif EXPRES : | ELIF S ELIF S | ELIF S ELSE S;
TYPE -> str | float | int | double;
INPUT -> input INBRACKET | TYPE ( INPUT );
RANGE -> range INBRACKET;
FROM -> from VARVAL IMPORT ;
WHILE -> while EXPRES : ;
FOR -> for VAR in STRING : | for VAR in RANGE : ;
RETURN -> return BOOLEAN | return VARVAL;
CLASS -> class VAR :;
NONE -> None;
IMPORT -> import VARVAL as VAR | import VARVAL;
METHOD -> VAR INBRACKET | VAR INBRACKET . METHOD | VAR . METHOD ;
DEF -> def VAR INBRACKET : ;
WITH -> with S as VAR : ;