From a3ba0ef35da04266285c084f77f2c9373c1eb31b Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Mon, 18 May 2026 10:23:45 +0200 Subject: [PATCH] feat: add Midas EBNF --- syntax/midas.ebnf | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 syntax/midas.ebnf diff --git a/syntax/midas.ebnf b/syntax/midas.ebnf new file mode 100644 index 0000000..71b4740 --- /dev/null +++ b/syntax/midas.ebnf @@ -0,0 +1,26 @@ +identifier ::= '[a-zA-Z][a-zA-Z_]*' + +integer ::= '\d+' +number ::= integer ["." integer] +boolean ::= "False" | "True" +none ::= "None" + +value ::= number | boolean | none +lambda-value ::= "_" | value +lambda-operator ::= ">" | "<" | ">=" | "<=" | "==" | "!=" +lambda ::= lambda-value lambda-operator lambda-value + +constraint ::= identifier | "(" lambda ")" +base-type ::= identifier +type ::= base-type { "+" constraint } + +type-property ::= 'identifier' ":" 'type' +type-body ::= "{" { 'type-property' } "}" + +operation-type ::= "<" 'type' ">" + +type-statement ::= "type" 'identifier' "<" 'type' {"," 'type'} ">" ['type-body'] +operation-statement ::= "op" 'operation-type' 'operator' 'operation-type' "=" 'operation-type' +constraint-statement ::= "constraint" 'identifier' "=" 'lambda' + +statement ::= type-statement | operation-statement | constraint-statement \ No newline at end of file