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