Canonical ingredients-oriented language

From Esolang
Jump to navigation Jump to search

The canonical ingredients-oriented language is an ingredients-oriented language designed for the sole purpose of demonstrating the ingredients-oriented paradigm.

Grammar

// Base Things
ingredient = NAME ;
ingredientusage = NAME ["[" expression "]"] ;
vessel = NAME ;
type = NAME ;
keyword = "unending" ;
keywords = {keyword}
declaration = keywords type NAME ["[" expression "]"] "=" expression ;

// Expressions
number = INT | FLOAT
val = ingredientusage | number | STRING
mixexpression = vessel "(" ({expression SEP} expression | "") ")" ;
binexp1 = expression "**" expression ;
binexp2 = expression ("*" | "/" | "%" expression ;
binexp3 = expression ("+" | "-") expression;
parenexp = "(" expression ")"
expression = val | mixexpression | parenexp | binexp1 | binexp2 | binexp3 ;

// Statements
dispose = DISPOSE ingredientusage ;
protocol = "protocol" NAME (line | "return" expression) ;
statement = dispose | protocol;

// Code
line = (declaration | expression | statement) TERMINATOR ;
block = BEGIN {line} END ;

// Control flow
emptyloop = "EMPTY" (declaration | expression | ingredient) block ;