# This is the grammar file for MIN source code. # MIN is a programming language I am designing, and was the application that originally motivated SSS. c ::= {Comment {COMMENT}} polarTypes ::= {Some {ROUND(listPolarType)}} simpleType ::= { Named {IDENTIFIER} Cons {c* CONSTANT polarTypes?} } type ::= { Menu {BRACE(simpleType+)} Simple {simpleType} } polarType ::= { Input {"?" type} Output {"!" type} } commaPolarType ::= {Comma {"," c* polarType}} listPolarType ::= {List {c* polarType commaPolarType*}} exprs ::= {Some {ROUND(listExpr)}} expr ::= { Left {":" IDENTIFIER} Right {IDENTIFIER ":"} Node {IDENTIFIER exprs?} Cons {CONSTANT exprs?} Merge {"MERGE" exprs} Halt {"HALT"} Pick {BRACE(graph+) ":" IDENTIFIER} } commaExpr ::= {Comma {"," c* expr}} listExpr ::= {List {c* expr commaExpr*}} graph ::= {Cut {c* expr "=" expr}} arg ::= {Arg {IDENTIFIER ":"}} commaArg ::= {Comma {"," c* arg}} listArg ::= {List {c* arg commaArg*}} args ::= {Some {ROUND(listArg)}} case ::= {Case {c* CONSTANT args? BRACE(graph+)}} else ::= {Else {"ELSE" expr}} argType ::= {Arg {IDENTIFIER ":" polarType}} commaArgType ::= {Comma {"," c* argType}} listArgType ::= {List {c* argType commaArgType*}} argTypes ::= {Some {ROUND(listArgType)}} declaration ::= { Type {"TYPE" IDENTIFIER "=" type} Subtype {"SUBTYPE" polarType "<:" polarType} Node {"NODE" IDENTIFIER argTypes? ":" "?" type "=" BRACE(case*) else?} } cDeclaration ::= {Comment {c* declaration}} version ::= {Version {STRING}} flag ::= { # No flags defined yet. # } source ::= { File { c* "MIN" version "FLAGS" BRACE(flag*) cDeclaration* c* "MAIN" ":" polarType "=" expr }} ROOT source