https://github.com/effeix/mopl
My Own Programming Language
https://github.com/effeix/mopl
Last synced: 6 days ago
JSON representation
My Own Programming Language
- Host: GitHub
- URL: https://github.com/effeix/mopl
- Owner: effeix
- License: mit
- Created: 2018-03-12T21:55:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-15T03:00:28.000Z (about 8 years ago)
- Last Synced: 2025-05-27T15:06:55.511Z (about 1 year ago)
- Language: Python
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MOPL
My Own Programming Language
### BNF
```bnf
program : statements
statements : statement
| statements statement
;
statement : attribution SEMI
| if SEMI
| if_else SEMI
| expression SEMI
| var_declaration SEMI
| var_declaration_attribution SEMI
| while SEMI
| write SEMI
| writeln SEMI
;
attribution : IDEN EQU expression ;
if_else : IF LPAR rel_expression RPAR BEGIN statements END
| IF LPAR rel_expression RPAR BEGIN statements END ELSE BEGIN statements END
;
expression : term
| term PLUS term
| term MIN term
| term OR term
;
var_declaration : type IDEN ;
var_declaration_attribution : type IDEN EQU expression ;
while : WHILE LPAR rel_expression RPAR DO BEGIN statement_list END ;
write : WRITE LPAR expression RPAR ;
writeln : WRITE LPAR expression RPAR NEWL ;
rel_expression : expression LT expression
| expression LTE expression
| expression GT expression
| expression GTE expression
| expression DEQU expression
| expression NEQU expression
;
empty : ;
term : factor
| factor MULT factor
| factor DIV factor
| factor AND factor
;
factor : NUMB
| IDEN
| LPAR expression RPAR
;
type : INTEGER ;
```