2 /* Copyright (c) 1997-1999 Matra Datavision
3 Copyright (c) 1999-2014 OPEN CASCADE SAS
5 This file is part of Open CASCADE Technology software library.
7 This library is free software; you can redistribute it and/or modify it under
8 the terms of the GNU Lesser General Public License version 2.1 as published
9 by the Free Software Foundation, with special exception defined in the file
10 OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 distribution for complete text of the license and disclaimer of any warranty.
13 Alternatively, this file may be used under the terms of Open CASCADE
14 commercial license or contractual agreement.
18 #include <ExprIntrp_yaccintrf.hxx>
20 extern void ExprIntrp_EndOfFuncDef();
21 extern void ExprIntrp_EndOfRelation();
22 extern void ExprIntrp_AssignVariable();
23 extern void ExprIntrp_EndOfAssign();
24 extern void ExprIntrp_Deassign();
25 extern void ExprIntrp_SumOperator();
26 extern void ExprIntrp_MinusOperator();
27 extern void ExprIntrp_ProductOperator();
28 extern void ExprIntrp_DivideOperator();
29 extern void ExprIntrp_ExpOperator();
30 extern void ExprIntrp_UnaryMinusOperator();
31 extern void ExprIntrp_UnaryPlusOperator();
32 extern void ExprIntrp_VariableIdentifier();
33 extern void ExprIntrp_NumValue();
34 extern void ExprIntrp_EndFunction();
35 extern void ExprIntrp_EndDerFunction();
36 extern void ExprIntrp_EndDifferential();
37 extern void ExprIntrp_EndDiffFunction();
38 extern void ExprIntrp_EndFuncArg();
39 extern void ExprIntrp_NextFuncArg();
40 extern void ExprIntrp_StartFunction();
41 extern void ExprIntrp_DefineFunction();
42 extern void ExprIntrp_StartDerivate();
43 extern void ExprIntrp_EndDerivate();
44 extern void ExprIntrp_DiffVar();
45 extern void ExprIntrp_DiffDegree();
46 extern void ExprIntrp_VerDiffDegree();
47 extern void ExprIntrp_DiffDegreeVar();
48 extern void ExprIntrp_StartDifferential();
49 extern void ExprIntrp_StartFunction();
50 extern void ExprIntrp_EndFuncArg();
51 extern void ExprIntrp_NextFuncArg();
52 extern void ExprIntrp_VariableIdentifier();
53 extern void ExprIntrp_Derivation();
54 extern void ExprIntrp_EndDerivation();
55 extern void ExprIntrp_DerivationValue();
56 extern void ExprIntrp_ConstantIdentifier();
57 extern void ExprIntrp_ConstantDefinition();
58 extern void ExprIntrp_VariableIdentifier();
59 extern void ExprIntrp_NumValue();
60 extern void ExprIntrp_Sumator();
61 extern void ExprIntrp_VariableIdentifier();
62 extern void ExprIntrp_Productor();
63 extern void ExprIntrp_EndOfEqual();
65 // disable MSVC warnings in bison code
67 #pragma warning(disable:4131 4244 4127 4702)
72 %token SUMOP MINUSOP DIVIDEOP EXPOP MULTOP PARENTHESIS BRACKET ENDPARENTHESIS ENDBRACKET VALUE IDENTIFIER COMMA DIFFERENTIAL DERIVATE DERIVKEY ASSIGNOP DEASSIGNKEY EQUALOP RELSEPARATOR CONSTKEY SUMKEY PRODKEY
84 | FunctionDefinition {ExprIntrp_EndOfFuncDef();}
85 | RelationList {ExprIntrp_EndOfRelation();}
88 Assignment : IDENTIFIER {ExprIntrp_AssignVariable();} ASSIGNOP GenExpr {ExprIntrp_EndOfAssign();}
91 Deassignment : DEASSIGNKEY BRACKET IDENTIFIER {ExprIntrp_Deassign();} ENDBRACKET
94 GenExpr : GenExpr SUMOP GenExpr {ExprIntrp_SumOperator();}
95 | GenExpr MINUSOP GenExpr {ExprIntrp_MinusOperator();}
96 | GenExpr MULTOP GenExpr {ExprIntrp_ProductOperator();}
97 | GenExpr DIVIDEOP GenExpr {ExprIntrp_DivideOperator();}
98 | GenExpr EXPOP GenExpr {ExprIntrp_ExpOperator();}
99 | PARENTHESIS GenExpr ENDPARENTHESIS
100 | BRACKET GenExpr ENDBRACKET
101 | MINUSOP GenExpr {ExprIntrp_UnaryMinusOperator();}
102 | SUMOP GenExpr {ExprIntrp_UnaryPlusOperator();}
115 Single : IDENTIFIER {ExprIntrp_VariableIdentifier();}
116 | VALUE {ExprIntrp_NumValue();}
119 Function : funcident PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndFunction();}
120 | DerFunctionId PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndDerFunction();}
121 | DiffFuncId {ExprIntrp_EndDifferential();} PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndDiffFunction();}
124 ListGenExpr : GenExpr {ExprIntrp_EndFuncArg();}
125 | GenExpr COMMA {ExprIntrp_NextFuncArg();} ListGenExpr
128 funcident : IDENTIFIER {ExprIntrp_StartFunction();}
131 FunctionDefinition : FunctionDef {ExprIntrp_DefineFunction();} ASSIGNOP GenExpr
134 DerFunctionId : IDENTIFIER {ExprIntrp_StartDerivate();} DERIVATE {ExprIntrp_EndDerivate();}
137 DiffFuncId : DIFFERENTIAL DiffId DIVIDEOP DIFFERENTIAL IDENTIFIER {ExprIntrp_DiffVar();}
138 | DIFFERENTIAL VALUE {ExprIntrp_DiffDegree();} DiffId DIVIDEOP DIFFERENTIAL VALUE {ExprIntrp_VerDiffDegree();} IDENTIFIER {ExprIntrp_DiffDegreeVar();}
141 DiffId : IDENTIFIER {ExprIntrp_StartDifferential();}
145 FunctionDef : IDENTIFIER {ExprIntrp_StartFunction();} BRACKET ListArg ENDBRACKET
148 ListArg : unarg {ExprIntrp_EndFuncArg();}
149 | unarg COMMA {ExprIntrp_NextFuncArg();} ListArg
152 unarg : IDENTIFIER {ExprIntrp_VariableIdentifier();}
155 Derivation : DERIVKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_Derivation();} ENDBRACKET {ExprIntrp_EndDerivation();}
156 | DERIVKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_Derivation();} COMMA VALUE {ExprIntrp_DerivationValue();} ENDBRACKET {ExprIntrp_EndDerivation();}
159 ConstantDefinition : CONSTKEY BRACKET IDENTIFIER {ExprIntrp_ConstantIdentifier();} COMMA VALUE {ExprIntrp_ConstantDefinition();} ENDBRACKET
162 Sumator : SUMKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_VariableIdentifier();} COMMA GenExpr COMMA GenExpr COMMA VALUE {ExprIntrp_NumValue();} ENDBRACKET {ExprIntrp_Sumator();}
165 Productor : PRODKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_VariableIdentifier();} COMMA GenExpr COMMA GenExpr COMMA VALUE {ExprIntrp_NumValue();} ENDBRACKET {ExprIntrp_Productor();}
168 RelationList : SingleRelation
169 | SingleRelation RELSEPARATOR RelationList
170 | SingleRelation '\n' RelationList
173 SingleRelation : GenExpr EQUALOP GenExpr {ExprIntrp_EndOfEqual();}