summaryrefslogtreecommitdiff
path: root/impl/EquationSystem.g
diff options
context:
space:
mode:
Diffstat (limited to 'impl/EquationSystem.g')
-rw-r--r--impl/EquationSystem.g18
1 files changed, 12 insertions, 6 deletions
diff --git a/impl/EquationSystem.g b/impl/EquationSystem.g
index 4884ca9..3ef9009 100644
--- a/impl/EquationSystem.g
+++ b/impl/EquationSystem.g
@@ -14,6 +14,7 @@ tokens {
GUARD = 'guard' ;
GREATER_EQUAL = '>=' ;
QUESTION_MARK = '?' ;
+ MCF = 'MCF' ;
MAXIMUM = 'max' ;
MINIMUM = 'min' ;
NEWLINE = '\n' ;
@@ -26,18 +27,23 @@ maxExpr : MAXIMUM^ '('! minExpr ( ','! minExpr )* ')'! | minExpr ;
minExpr : MINIMUM^ '('! maxExpr ( ','! maxExpr )* ')'! | expr ;
expr : '(' expr GREATER_EQUAL expr QUESTION_MARK expr ')' -> ^(GUARD expr expr expr)
- | GUARD^ '('! maxExpr ','! maxExpr ','! maxExpr ')'!
- | 'add'^ '('! maxExpr ( ','! maxExpr )* ')'!
- | 'sub'^ '('! maxExpr ( ','! maxExpr )* ')'!
- | 'mult'^ '('! maxExpr ( ','! maxExpr )* ')'!
- | term ( (PLUS | MULT | SUB | COMMA)^ expr )* ;
+ | GUARD^ '('! maxExpr ','! maxExpr ','! maxExpr ')'!
+ | MCF^ '<'! supplies ','! arcs '>'! '('! maxExpr (','! maxExpr)* ')'!
+ | 'add'^ '('! maxExpr ( ','! maxExpr )* ')'!
+ | 'sub'^ '('! maxExpr ( ','! maxExpr )* ')'!
+ | 'mult'^ '('! maxExpr ( ','! maxExpr )* ')'!
+ | term ( (PLUS | MULT | SUB | COMMA)^ expr )* ;
+
+supplies : '['^ NUMBER (','! NUMBER)* ']'! ;
+arc : NUMBER ':'^ NUMBER ;
+arcs : '['^ arc (','! arc)* ']'! ;
term : NUMBER
| VARIABLE
| '-'^ term ;
-NUMBER : (DIGIT)+ ;
+NUMBER : '-'? (DIGIT)+ ;
VARIABLE: (LETTER) (LETTER | DIGIT | '-' | '\[' | ']' )* ;
WHITESPACE : ( '\t' | ' ' | '\u000C' )+
{