fix: change syntax definition to W3C EBNF

This commit is contained in:
2026-05-20 15:47:34 +02:00
parent adf7f4e7a2
commit 7477ec8d70

View File

@@ -1,26 +1,27 @@
identifier ::= '[a-zA-Z][a-zA-Z_]*' // W3C EBNF syntax definition for Midas
Identifier ::= [a-zA-Z] [a-zA-Z_]*
integer ::= '\d+' Integer ::= '\d+'
number ::= integer ["." integer] Number ::= Integer ("." Integer)?
boolean ::= "False" | "True" Boolean ::= "False" | "True"
none ::= "None" None ::= "None"
value ::= number | boolean | none Value ::= Number | Boolean | None
lambda-value ::= "_" | value LambdaValue ::= "_" | Value
lambda-operator ::= ">" | "<" | ">=" | "<=" | "==" | "!=" LambdaOperator ::= ">" | "<" | ">=" | "<=" | "==" | "!="
lambda ::= lambda-value lambda-operator lambda-value Lambda ::= LambdaValue LambdaOperator LambdaValue
constraint ::= identifier | "(" lambda ")" Constraint ::= Identifier | "(" Lambda ")"
base-type ::= identifier BaseType ::= Identifier
type ::= base-type { "+" constraint } Type ::= BaseType ("+" Constraint)*
type-property ::= 'identifier' ":" 'type' TypeProperty ::= Identifier ":" Type
type-body ::= "{" { 'type-property' } "}" TypeBody ::= "{" TypeProperty* "}"
operation-type ::= "<" 'type' ">" OperationType ::= "<" Type ">"
type-statement ::= "type" 'identifier' "<" 'type' {"," 'type'} ">" ['type-body'] TypeStatement ::= "type" Identifier "<" Type ("," Type)* ">" TypeBody?
operation-statement ::= "op" 'operation-type' 'operator' 'operation-type' "=" 'operation-type' OperationStatement ::= "op" OperationType [^\s]+ OperationType "=" OperationType
constraint-statement ::= "constraint" 'identifier' "=" 'lambda' ConstraintStatement ::= "constraint" Identifier "=" Lambda
statement ::= type-statement | operation-statement | constraint-statement Statement ::= TypeStatement | OperationStatement | ConstraintStatement