Changeset 13316
- Timestamp:
- 2012-10-11T16:55:29+02:00 (12 years ago)
- Location:
- trunk/testsuite/openmodelica/omcc
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/testsuite/openmodelica/omcc/LexerModelica.mo
r12732 r13316 181 181 (resToken,program2) := match (program1,tokens1) 182 182 local 183 Integer c,d,act,val,c2,curr2,fchar; 183 // Integer c,d,act,val,c2,curr2,fchar; 184 Integer d,act,val,c2,curr2,fchar; 184 185 list<Integer> rest; 185 186 list<OMCCTypes.Token> lToken; -
trunk/testsuite/openmodelica/omcc/Main.mo
r12732 r13316 29 29 String s,str; 30 30 Boolean result; 31 Real tp,tl,tt; 31 32 case args as _::_ 32 33 equation … … 38 39 // call the lexer 39 40 print("\nstarting lexer"); 41 System.realtimeTick(1); // enable if you need timing measurements 40 42 tokens = LexerModelica.scan(filename,false); 43 tl = System.realtimeTock(1)*1000; // enable if you need timing measurements 44 print("\n Time Lexer:" + realString(tl)); // enable if you need timing measurements 41 45 print("\n"); 42 print(OMCCTypes.printTokens(tokens,""));43 print("\n Tokens processed:");44 print(intString(listLength(tokens)));46 // print(OMCCTypes.printTokens(tokens,"")); 47 print("\n Tokens processed:"); 48 print(intString(listLength(tokens))); 45 49 46 50 47 51 // call the parser 48 52 print("\nstarting parser"); 49 (result,astTreeModelica) = ParserModelica.parse(tokens,filename,true); 53 54 System.realtimeTick(1); // enable if you need timing measurements 55 (result,astTreeModelica) = ParserModelica.parse(tokens,filename,true); 56 57 tp = System.realtimeTock(1)*1000; // enable if you need timing measurements 58 print("\n Time Parser:" + realString(tp)); // enable if you need timing measurements 59 print("\n"); 60 tt = tl+tp; // enable if you need timing measurements 61 print("\n Total Time:" + realString(tt)); // enable if you need timing measurements 50 62 print("\n"); 51 63 -
trunk/testsuite/openmodelica/omcc/Makefile
r13244 r13316 8 8 @echo OPENMODELICAHOME=" $(OPENMODELICAHOME) " 9 9 @echo 10 @echo Setting BaseLine...11 10 @echo 12 11 @$(OMC) $(TESTFLAG) SCRIPT.mos -
trunk/testsuite/openmodelica/omcc/ParseCodeModelica.mo
r12732 r13316 2193 2193 v1ElementSpec::skElementSpec = skElementSpec; 2194 2194 // build 2195 vElement = Absyn.ELEMENT(false,NONE(),Absyn.NOT_INNER_OUTER(), "IMPORT",(v1ElementSpec),info,NONE());2195 vElement = Absyn.ELEMENT(false,NONE(),Absyn.NOT_INNER_OUTER(),(v1ElementSpec),info,NONE()); 2196 2196 // push Result 2197 2197 skElement= vElement::skElement; … … 2205 2205 v1ElementSpec::skElementSpec = skElementSpec; 2206 2206 // build 2207 vElement = Absyn.ELEMENT(false,NONE(),Absyn.NOT_INNER_OUTER(), "EXTENDS",(v1ElementSpec),info,NONE());2207 vElement = Absyn.ELEMENT(false,NONE(),Absyn.NOT_INNER_OUTER(),(v1ElementSpec),info,NONE()); 2208 2208 // push Result 2209 2209 skElement= vElement::skElement; … … 2258 2258 v1ElementSpec::skElementSpec = skElementSpec; 2259 2259 // build 2260 vElement = Absyn.ELEMENT(false,NONE(),Absyn.NOT_INNER_OUTER(), "??",(v1ElementSpec),info,NONE());2260 vElement = Absyn.ELEMENT(false,NONE(),Absyn.NOT_INNER_OUTER(),(v1ElementSpec),info,NONE()); 2261 2261 // push Result 2262 2262 skElement= vElement::skElement; … … 2271 2271 v1ElementSpec::skElementSpec = skElementSpec; 2272 2272 // build 2273 vElement = Absyn.ELEMENT(false,SOME(Absyn.REDECLARE()),Absyn.NOT_INNER_OUTER(), "CLASS",(v1ElementSpec),info,NONE());2273 vElement = Absyn.ELEMENT(false,SOME(Absyn.REDECLARE()),Absyn.NOT_INNER_OUTER(),(v1ElementSpec),info,NONE()); 2274 2274 // push Result 2275 2275 skElement= vElement::skElement; … … 2283 2283 v1ElementSpec::skElementSpec = skElementSpec; 2284 2284 // build 2285 vElement = Absyn.ELEMENT(false,NONE(),Absyn.NOT_INNER_OUTER(), "component",(v1ElementSpec),info,NONE());2285 vElement = Absyn.ELEMENT(false,NONE(),Absyn.NOT_INNER_OUTER(),(v1ElementSpec),info,NONE()); 2286 2286 // push Result 2287 2287 skElement= vElement::skElement; … … 2296 2296 v1InnerOuter::skInnerOuter = skInnerOuter; 2297 2297 // build 2298 vElement = Absyn.ELEMENT(false,NONE(),(v1InnerOuter), "INNEROUTTER ELEMENTSPEC",(v2ElementSpec),info,NONE());2298 vElement = Absyn.ELEMENT(false,NONE(),(v1InnerOuter),(v2ElementSpec),info,NONE()); 2299 2299 // push Result 2300 2300 skElement= vElement::skElement; … … 2311 2311 v1RedeclareKeywords::skRedeclareKeywords = skRedeclareKeywords; 2312 2312 // build 2313 vElement = Absyn.ELEMENT((v2Boolean),SOME((v1RedeclareKeywords)),(v3InnerOuter), "REDE ELEMENTSPEC",(v4ElementSpec),info,NONE());2313 vElement = Absyn.ELEMENT((v2Boolean),SOME((v1RedeclareKeywords)),(v3InnerOuter),(v4ElementSpec),info,NONE()); 2314 2314 // push Result 2315 2315 skElement= vElement::skElement; … … 2325 2325 v1RedeclareKeywords::skRedeclareKeywords = skRedeclareKeywords; 2326 2326 // build 2327 vElement = Absyn.ELEMENT((v2Boolean),SOME((v1RedeclareKeywords)),Absyn.NOT_INNER_OUTER(), "REDE ELEMENTSPEC",(v3ElementSpec),info,NONE());2327 vElement = Absyn.ELEMENT((v2Boolean),SOME((v1RedeclareKeywords)),Absyn.NOT_INNER_OUTER(),(v3ElementSpec),info,NONE()); 2328 2328 // push Result 2329 2329 skElement= vElement::skElement; … … 2340 2340 v1RedeclareKeywords::skRedeclareKeywords = skRedeclareKeywords; 2341 2341 // build 2342 vElement = Absyn.ELEMENT((v2Boolean),SOME((v1RedeclareKeywords)),Absyn.NOT_INNER_OUTER(), "REDE ELEMENTSPEC",(v3ElementSpec),info,SOME((v4ConstrainClass)));2342 vElement = Absyn.ELEMENT((v2Boolean),SOME((v1RedeclareKeywords)),Absyn.NOT_INNER_OUTER(),(v3ElementSpec),info,SOME((v4ConstrainClass))); 2343 2343 // push Result 2344 2344 skElement= vElement::skElement; … … 2353 2353 v1String::skString = skString; 2354 2354 // build 2355 vElement = Absyn.ELEMENT(true,NONE(),Absyn.NOT_INNER_OUTER(), "FINAL ELEMENTSPEC",(v2ElementSpec),info,NONE());2355 vElement = Absyn.ELEMENT(true,NONE(),Absyn.NOT_INNER_OUTER(),(v2ElementSpec),info,NONE()); 2356 2356 // push Result 2357 2357 skElement= vElement::skElement; … … 2367 2367 v1String::skString = skString; 2368 2368 // build 2369 vElement = Absyn.ELEMENT(true,NONE(),(v2InnerOuter), "FINAL INNEROUTER ELEMENTSPEC",(v3ElementSpec),info,NONE());2369 vElement = Absyn.ELEMENT(true,NONE(),(v2InnerOuter),(v3ElementSpec),info,NONE()); 2370 2370 // push Result 2371 2371 skElement= vElement::skElement; … … 3754 3754 v1String::skString = skString; 3755 3755 // build 3756 vCase = Absyn.CASE((v2Exp), info,{},{},(v4Exp),info,NONE(),info);3756 vCase = Absyn.CASE((v2Exp),NONE(),info,{},{},(v4Exp),info,NONE(),info); 3757 3757 // push Result 3758 3758 skCase= vCase::skCase; … … 3771 3771 v1String::skString = skString; 3772 3772 // build 3773 vCase = Absyn.CASE((v2Exp), info,{},{},(v4Exp),info,NONE(),info);3773 vCase = Absyn.CASE((v2Exp),NONE(),info,{},{},(v4Exp),info,NONE(),info); 3774 3774 // push Result 3775 3775 skCase= vCase::skCase; … … 3789 3789 v1String::skString = skString; 3790 3790 // build 3791 vCase = Absyn.CASE((v2Exp), info,{},(v4EquationItems),(v6Exp),info,NONE(),info);3791 vCase = Absyn.CASE((v2Exp),NONE(),info,{},(v4EquationItems),(v6Exp),info,NONE(),info); 3792 3792 // push Result 3793 3793 skCase= vCase::skCase; … … 5051 5051 Variability variability,v1 "variability ; parameter, constant etc." ; 5052 5052 Direction direction,d1 "direction" ; 5053 // Absyn.Parallelism parallelism; 5053 5054 Absyn.Parallelism parallelism; 5054 5055 ArrayDim arrayDim,a1 "arrayDim" ; -
trunk/testsuite/openmodelica/omcc/ParserModelica.mo
r12732 r13316 132 132 input OMCCTypes.Info info; 133 133 algorithm 134 Error.addSourceMessage(Error.SYNTAX_ERROR,errStk,info); 134 // Error.addSourceMessage(Error.SYNTAX_ERROR,errStk,info); 135 Error.addSourceMessage(Error.LOOKUP_ERROR,errStk,info); 135 136 //print(printSemStack(listReverse(errStk),"")); 136 137 end addSourceMessage; … … 160 161 // env variables 161 162 OMCCTypes.Token cTok,nTk; 163 OMCCTypes.Token c,nt; 162 164 ParseCodeModelica.AstStack astStk,astSkBk; 163 165 Boolean debug; … … 189 191 list<OMCCTypes.Token> rest; 190 192 list<Integer> vl; 191 OMCCTypes.Token c,nt; 193 // OMCCTypes.Token c,nt; 194 OMCCTypes.Token c1,nt1; 192 195 Integer n,len,val,tok,tmTok,chkVal; 193 196 String nm,semVal; … … 260 263 cSt = n; 261 264 stateStk = cSt::stateStk; 262 env2 = ENV(c,nt,stateStk,errStk,errSt,sSt,cSt,rest,rest,astStk,debug,stateSkBk,astSkBk);263 265 // env2 = ENV(c,nt,stateStk,errStk,errSt,sSt,cSt,rest,rest,astStk,debug,stateSkBk,astSkBk); 266 env2 = ENV(c1,nt1,stateStk,errStk,errSt,sSt,cSt,rest,rest,astStk,debug,stateSkBk,astSkBk); 264 267 end if; 265 268 end if; -
trunk/testsuite/openmodelica/omcc/Readme.txt
r11952 r13316 2 2 // There are two folders named omcc and omcc_test in the directory trunk/openmodelica/testsuite/ 3 3 // the "omcc" folder contains the implemented code and the "omcc_test" folder contains the test cases 4 // the omccp is tested with 102 test cases,look for the file SCRIPT.mos in the folder "omcc"4 // look for the file SCRIPT.mos in the folder "omcc" 5 5 // to make the compilation process easier a Makefile is created.(look into the omcc folder) 6 6 7 7 1) Open the mingw terminal if you are a windows user and normal terminal for linux user 8 8 9 2) In the terminal window go to the path / openmodelica/testsuite/omcc9 2) In the terminal window go to the path /OpenModelica/testsuite/openmodelica/omcc 10 10 11 3) at present the code is tested with testing environment rtest, and the baseline is added to makefile so no need to set baseline everytime you compile, it will be generated automatically by makefile 11 3) at present the code is tested with testing environment rtest, and the baseline is added to makefile so set the basline by typing 12 "make baseline" in the terminal without quotes. baseline will be set. You have to set the baseline first everytime before you test your models 12 13 13 14 4) Then type the command "make test" or "make" in the terminal window, the omccp will be compiled and ready to run … … 21 22 8) Open the file "SCRIPT.mos" and look for the comments // add your testfiles here 22 23 23 9) at present only 21 test cases are tested and remaining are commented, you are free to test the remaining files by uncommenting them.24 25 24 Note: you can look a clear picture of the output in the file SCRIPT.mos. 26 25 Note: to run the omcc without use of make file use the following ../../../build/bin/omc +g=MetaModelica +d=rml SCRIPT.mos -
trunk/testsuite/openmodelica/omcc/SCRIPT.mos
r13244 r13316 32 32 // add your test files here 33 33 34 {Main.main({"../../testsuite/omcc_test/" + file,"Modelica"}) for file in {"Test1.mo","Test2.mo","Test3.mo","Test4.mo", 34 35 {Main.main({"../omcc_test/" + file,"Modelica"}) for file in {"Test1.mo","Test2.mo","Test3.mo","Test4.mo", 35 36 "Test5.mo","Test6.mo","Test7.mo","Test8.mo","Test9.mo","Test10.mo", 36 37 "Test11.mo","Test12.mo","Test13.mo","Test14.mo","Test15.mo","Test16.mo", … … 41 42 // uncomment to run these test cases 42 43 /* 43 {Main.main({"../../testsuite/mofiles/" + file,"Modelica"}) for file in {"Abs.mo","Abs1.mo","AddReal1.mo","Algorithm1.mo","Algorithm3.mo","AlgorithmElseOpt.mo","AlgorithmFor1.mo","AlgorithmFor2.mo","AlgorithmFor3.mo","AlgorithmFor4.mo","AlgorithmFor5.mo" 44 ,"AlgorithmFor6.mo","And.mo","Array1.mo","Array2.mo","Array3.mo","Array4.mo","Array5.mo","Array6.mo","Array7.mo","Array8.mo" 44 {Main.main({"../../flattening/modelica/arrays/" + file,"Modelica"}) for file in {"Array1.mo","Array2.mo","Array3.mo","Array4.mo","Array5.mo","Array6.mo","Array7.mo","Array8.mo" 45 45 ,"Array9.mo","Array10.mo","Array13.mo","Array14.mo","ArrayAccess.mo","ArrayAddition.mo","ArrayAddition2.mo","ArrayAsAlias.mo", 46 46 "ArrayAsAliasInExtends.mo","ArrayBrackets.mo","ArrayCall.mo","ArrayCurlyBrackets.mo" … … 49 49 50 50 51 {Main.main({"../../Examples/" + file,"Modelica"}) for file in {"BouncingBall.mo","bubblesort.mo","Circle.mo","dcmotor.mo","ExternalLibraries.mo" 51 {Main.main({"../../flattening/modelica/algorithms-functions/" + file,"Modelica"}) for file in {"Algorithm1.mo","Algorithm3.mo","AlgorithmElseOpt.mo","AlgorithmFor1.mo", 52 "AlgorithmFor2.mo","AlgorithmFor3.mo","AlgorithmFor4.mo","AlgorithmFor5.mo", 53 "AlgorithmFor6.mo"}}; 54 55 56 57 {Main.main({"../../flattening/modelica/built-in-functions/" + file,"Modelica"}) for file in {"Abs.mo","Abs1.mo","Delay.mo","Delay2.mo","Delay3.mo", 58 "Delay4.mo","Delay6.mo","DerConstant1.mo","DerConstant2.mo"}}; 59 60 61 {Main.main({"../../flattening/modelica/operators/" + file,"Modelica"}) for file in {"And.mo"}}; 62 63 {Main.main({"../../flattening/modelica/external-functions/" + file,"Modelica"}) for file in {"AddReal1.mo"}}; 64 65 {Main.main({"../../flattening/modelica/others/" + file,"Modelica"}) for file in{"BooleanLiterals.mo","Class1.mo", 66 "Comment1.mo"}}; 67 68 69 70 71 {Main.main({"../../../Examples/" + file,"Modelica"}) for file in {"BouncingBall.mo","bubblesort.mo","Circle.mo","dcmotor.mo","ExternalLibraries.mo" 52 72 ,"HelloWorld.mo","Influenza.mo","SimpleIntegrator.mo","Switch.mo","VanDerPol.mo" 53 73 ,"visualize_3D_BouncingBall.mo"}}; 54 74 55 75 56 57 58 {Main.main({"../../testsuite/mofiles/" + file,"Modelica"}) for file in {"ArrayDivision.mo","ArrayEWOps1.mo","ArrayEWOps2.mo","ArrayEWOps3.mo", 76 {Main.main({"../../flattening/modelica/arrays/" + file,"Modelica"}) for file in {"ArrayDivision.mo","ArrayEWOps1.mo","ArrayEWOps2.mo","ArrayEWOps3.mo", 59 77 "ArrayEWOps4.mo","ArrayEWOps5.mo","ArrayEWOps6.mo","ArrayEWOpsCEval1.mo", 60 78 "ArrayEWOpsCEval2.mo","ArrayEWOpsCEval3.mo","ArrayEWOpsCEval4.mo","ArrayEWOpsCEval5.mo", 61 79 "ArrayExtend.mo","ArrayExtendsUnknown.mo","ArrayIndex.mo","ArrayIndex2.mo", 62 "ArrayLogic.mo","ArrayMatrixSimplifier.mo","BooleanLiterals.mo","Class1.mo", 63 "Circle.mo","Comment1.mo","DeclarationOrder.mo","DeclarationOrder1.mo","DeclarationOrder2.mo", 64 "Delay.mo","Delay2.mo","Delay3.mo","Delay4.mo","Delay6.mo","DerConstant1.mo","DerConstant2.mo"}}; 80 "ArrayLogic.mo","ArrayMatrixSimplifier.mo"}}; 81 82 83 {Main.main({"../../flattening/modelica/declarations/" + file,"Modelica"}) for file in{"DeclarationOrder.mo","DeclarationOrder1.mo","DeclarationOrder2.mo"}}; 84 65 85 */ 66 86 67 68 87 // run this to test the full modelica grammar 69 // Main.main({"../ ../testsuite/omcc_test/fulltest.mo","Modelica"});88 // Main.main({"../omcc_test/fulltest.mo","Modelica"}); 70 89 71 90 72 91 73 92 getErrorString(); 74 // Result:75 // true76 // true77 // true78 // true79 // true80 // true81 // true82 // true83 // true84 // true85 // true86 // true87 // true88 // true89 // true90 // true91 // true92 // true93 // true94 // true95 // true96 // true97 // true98 // true99 // true100 //101 // "[LexerModelica.mo:183:7-183:41:writable] Error: Local variable 'c' shadows another variable.102 // "103 // endResult
Note: See TracChangeset
for help on using the changeset viewer.