Skip to content

prince-ao/dipole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Dipole Programming Language
---
Grammar:
<program>_S ::= <statement>* EOT ;
<statement> ::= 
	<printStmt> | 
	<ifStmt> | 
	<declStmt> | 
	<assignStmt> |
	<whileLoop> |
	<forLoop>;
<printStmt> ::= 'print' <expression> ( 'new_line' | ';' ) ;
<ifStmt> ::= <ifHead> | <ifHead> 'else' <block> ;
<ifHead> ::= 'if' '(' <expression> ')' <block> ;
<block> ::= '{' <statement>* '}' ;
<declStmt> ::= 'let' 'identifier' ( '=' <expression> )? ( 'new_line' | ';' ) ;
<assignStmt> ::= 'identifier' '=' <expression>  ( 'new_line' | ';' ) ;
<whileLoop> ::= 'while' '(' <expression> ')' <block> ;
<forLoop> ::= 'for' '(' ( <declStmt> | <assignStmt> )? ( <expression> )? ';' ( <assignStmt> )? ')' <block> ;
<expression> ::= <logic_op> ;
<logic_op>  ::= <equality> (('or' | 'and') <equality>)* ;
<equality> ::= <comparison> (('!=' | '==') <comparison>)* ;
<comparison> ::= <term> (('>' | '>=' | '<' | '<=') <term>)* ;
<term> ::= <factor> (('+' | '-') <factor>)* ;
<factor> ::= <unary> (('*' | '/') <unary>)* ;
<unary> ::= ('-' | '!') <unary> | <primary> ;
<primary> ::= 
	'int' | 
	'true' | 
	'false' | 
	'none' | 
	'identifier' | 
	'string' |
	(' <expression> ')' ;

About

a programming language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published