├── Project.toml └── src └── SCode.jl /Project.toml: -------------------------------------------------------------------------------- 1 | name = "SCode" 2 | uuid = "350d45b0-c210-11e9-3b9e-fdad65bb3d46" 3 | authors = ["johti "] 4 | version = "1.1.0" 5 | 6 | [deps] 7 | Absyn = "ce2f92e2-a952-11e9-0543-8b443f216f1d" 8 | ExportAll = "ad2082ca-a69e-11e9-38fa-e96309a31fe4" 9 | ImmutableList = "4a558cac-c1ed-11e9-20da-3584bcd8709a" 10 | MetaModelica = "9d7f2a79-07b5-5542-8b19-c0100dda6b06" 11 | -------------------------------------------------------------------------------- /src/SCode.jl: -------------------------------------------------------------------------------- 1 | module SCode 2 | 3 | 4 | using MetaModelica 5 | #= ExportAll is not good practice but it makes it so that we do not have to write export after each function :( =# 6 | using ExportAll 7 | #= Necessary to write declarations for your uniontypes until Julia adds support for mutually recursive types =# 8 | 9 | @UniontypeDecl Restriction 10 | @UniontypeDecl FunctionRestriction 11 | @UniontypeDecl Mod 12 | @UniontypeDecl SubMod 13 | @UniontypeDecl Enum 14 | @UniontypeDecl ClassDef 15 | @UniontypeDecl Comment 16 | @UniontypeDecl Annotation 17 | @UniontypeDecl ExternalDecl 18 | @UniontypeDecl Equation 19 | @UniontypeDecl EEquation 20 | @UniontypeDecl AlgorithmSection 21 | @UniontypeDecl ConstraintSection 22 | @UniontypeDecl Statement 23 | @UniontypeDecl Visibility 24 | @UniontypeDecl Redeclare 25 | @UniontypeDecl ConstrainClass 26 | @UniontypeDecl Replaceable 27 | @UniontypeDecl Final 28 | @UniontypeDecl Each 29 | @UniontypeDecl Encapsulated 30 | @UniontypeDecl Partial 31 | @UniontypeDecl ConnectorType 32 | @UniontypeDecl Prefixes 33 | @UniontypeDecl Element 34 | @UniontypeDecl Attributes 35 | @UniontypeDecl Parallelism 36 | @UniontypeDecl Variability 37 | @UniontypeDecl Initial 38 | 39 | #= /* 40 | * This file is part of OpenModelica. 41 | * 42 | * Copyright (c) 1998-2014, Open Source Modelica Consortium (OSMC), 43 | * c/o Linköpings universitet, Department of Computer and Information Science, 44 | * SE-58183 Linköping, Sweden. 45 | * 46 | * All rights reserved. 47 | * 48 | * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR 49 | * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2. 50 | * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES 51 | * RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, 52 | * ACCORDING TO RECIPIENTS CHOICE. 53 | * 54 | * The OpenModelica software and the Open Source Modelica 55 | * Consortium (OSMC) Public License (OSMC-PL) are obtained 56 | * from OSMC, either from the above address, 57 | * from the URLs: http:www.ida.liu.se/projects/OpenModelica or 58 | * http:www.openmodelica.org, and in the OpenModelica distribution. 59 | * GNU version 3 is obtained from: http:www.gnu.org/copyleft/gpl.html. 60 | * 61 | * This program is distributed WITHOUT ANY WARRANTY; without 62 | * even the implied warranty of MERCHANTABILITY or FITNESS 63 | * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH 64 | * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL. 65 | * 66 | * See the full OSMC Public License conditions for more details. 67 | * 68 | */ =# 69 | 70 | import Absyn 71 | 72 | #= Some definitions are aliased from Absyn 73 | =# 74 | 75 | const Ident = Absyn.Ident 76 | 77 | const Path = Absyn.Path 78 | 79 | const Subscript = Absyn.Subscript 80 | 81 | @Uniontype Restriction begin 82 | @Record R_CLASS begin 83 | 84 | end 85 | 86 | @Record R_OPTIMIZATION begin 87 | 88 | end 89 | 90 | @Record R_MODEL begin 91 | 92 | end 93 | 94 | @Record R_RECORD begin 95 | 96 | isOperator::Bool 97 | end 98 | 99 | @Record R_BLOCK begin 100 | 101 | end 102 | 103 | @Record R_CONNECTOR begin 104 | 105 | isExpandable #= is expandable? =#::Bool 106 | end 107 | 108 | @Record R_OPERATOR begin 109 | 110 | end 111 | 112 | @Record R_TYPE begin 113 | 114 | end 115 | 116 | @Record R_PACKAGE begin 117 | 118 | end 119 | 120 | @Record R_FUNCTION begin 121 | 122 | functionRestriction::FunctionRestriction 123 | end 124 | 125 | @Record R_ENUMERATION begin 126 | 127 | end 128 | 129 | #= predefined internal types 130 | =# 131 | 132 | @Record R_PREDEFINED_INTEGER begin 133 | 134 | end 135 | 136 | @Record R_PREDEFINED_REAL begin 137 | 138 | end 139 | 140 | @Record R_PREDEFINED_STRING begin 141 | 142 | end 143 | 144 | @Record R_PREDEFINED_BOOLEAN begin 145 | 146 | end 147 | 148 | @Record R_PREDEFINED_ENUMERATION begin 149 | 150 | end 151 | 152 | #= BTH 153 | =# 154 | 155 | @Record R_PREDEFINED_CLOCK begin 156 | 157 | end 158 | 159 | #= MetaModelica extensions 160 | =# 161 | 162 | @Record R_METARECORD begin 163 | 164 | name::Absyn.Path 165 | #= Name of the uniontype 166 | =# 167 | index::ModelicaInteger 168 | #= Index in the uniontype 169 | =# 170 | singleton::Bool 171 | moved::Bool 172 | #= true if moved outside uniontype, otherwise false. 173 | =# 174 | typeVars::List{String} 175 | end 176 | 177 | #= /* added by x07simbj */ =# 178 | 179 | @Record R_UNIONTYPE begin 180 | 181 | typeVars::List{String} 182 | end 183 | 184 | #= /* added by simbj */ =# 185 | end 186 | 187 | #= Same as Absyn.FunctionRestriction except this contains 188 | =# 189 | #= FR_EXTERNAL_FUNCTION and FR_RECORD_CONSTRUCTOR. 190 | =# 191 | 192 | @Uniontype FunctionRestriction begin 193 | @Record FR_NORMAL_FUNCTION begin 194 | 195 | isImpure #= true for impure functions, false otherwise =#::Bool 196 | end 197 | 198 | @Record FR_EXTERNAL_FUNCTION begin 199 | 200 | isImpure #= true for impure functions, false otherwise =#::Bool 201 | end 202 | 203 | @Record FR_OPERATOR_FUNCTION begin 204 | 205 | end 206 | 207 | @Record FR_RECORD_CONSTRUCTOR begin 208 | 209 | end 210 | 211 | @Record FR_PARALLEL_FUNCTION begin 212 | 213 | end 214 | 215 | @Record FR_KERNEL_FUNCTION begin 216 | 217 | end 218 | end 219 | 220 | #= - Modifications =# 221 | @Uniontype Mod begin 222 | @Record MOD begin 223 | 224 | finalPrefix #= final prefix =#::Final 225 | eachPrefix #= each prefix =#::Each 226 | subModLst::List{SubMod} 227 | binding::Option{Absyn.Exp} 228 | info::SourceInfo 229 | end 230 | 231 | @Record REDECL begin 232 | 233 | finalPrefix #= final prefix =#::Final 234 | eachPrefix #= each prefix =#::Each 235 | element #= The new element declaration. =#::Element 236 | end 237 | 238 | @Record NOMOD begin 239 | 240 | end 241 | end 242 | 243 | #= Modifications are represented in an more structured way than in 244 | the `Absyn\\' module. Modifications using qualified names 245 | (such as in `x.y = z\\') are normalized (to `x(y = z)\\'). =# 246 | @Uniontype SubMod begin 247 | @Record NAMEMOD begin 248 | 249 | ident::Ident 250 | mod #= A named component =#::Mod 251 | end 252 | end 253 | 254 | const Program = List #= - Programs 255 | As in the AST, a program is simply a list of class definitions. =# 256 | 257 | #= Enum, which is a name in an enumeration and an optional Comment. =# 258 | @Uniontype Enum begin 259 | @Record ENUM begin 260 | 261 | literal::Ident 262 | comment::Comment 263 | end 264 | end 265 | 266 | #= The major difference between these types and their Absyn 267 | counterparts is that the PARTS constructor contains separate 268 | lists for elements, equations and algorithms. 269 | 270 | SCode.PARTS contains elements of a class definition. For instance, 271 | model A 272 | extends B; 273 | C c; 274 | end A; 275 | Here PARTS contains two elements ('extends B' and 'C c') 276 | SCode.DERIVED is used for short class definitions, i.e: 277 | class A = B[ArrayDims](modifiers); 278 | SCode.CLASS_EXTENDS is used for extended class definition, i.e: 279 | class extends A (modifier) 280 | new elements; 281 | end A; =# 282 | @Uniontype ClassDef begin 283 | @Record PARTS begin 284 | 285 | elementLst #= the list of elements =#::List{Element} 286 | normalEquationLst #= the list of equations =#::List{Equation} 287 | initialEquationLst #= the list of initial equations =#::List{Equation} 288 | normalAlgorithmLst #= the list of algorithms =#::List{AlgorithmSection} 289 | initialAlgorithmLst #= the list of initial algorithms =#::List{AlgorithmSection} 290 | constraintLst #= the list of constraints =#::List{ConstraintSection} 291 | clsattrs #= the list of class attributes. Currently for Optimica extensions =#::List{Absyn.NamedArg} 292 | externalDecl #= used by external functions =#::Option{ExternalDecl} 293 | end 294 | 295 | @Record CLASS_EXTENDS begin 296 | 297 | modifications #= the modifications that need to be applied to the base class =#::Mod 298 | composition #= the new composition =#::ClassDef 299 | end 300 | 301 | @Record DERIVED begin 302 | 303 | typeSpec #= typeSpec: type specification =#::Absyn.TypeSpec 304 | modifications #= the modifications =#::Mod 305 | attributes #= the element attributes =#::Attributes 306 | end 307 | 308 | @Record ENUMERATION begin 309 | 310 | enumLst #= if the list is empty it means :, the supertype of all enumerations =#::List{Enum} 311 | end 312 | 313 | @Record OVERLOAD begin 314 | 315 | pathLst #= the path lists =#::List{Absyn.Path} 316 | end 317 | 318 | @Record PDER begin 319 | 320 | functionPath #= function name =#::Absyn.Path 321 | derivedVariables #= derived variables =#::List{Ident} 322 | end 323 | end 324 | 325 | @Uniontype Comment begin 326 | @Record COMMENT begin 327 | 328 | annotation_::Option{Annotation} 329 | comment::Option{String} 330 | end 331 | end 332 | 333 | const noComment = COMMENT(NONE(), NONE())::Comment 334 | #= stefan =# 335 | 336 | @Uniontype Annotation begin 337 | @Record ANNOTATION begin 338 | 339 | modification::Mod 340 | end 341 | end 342 | 343 | #= Declaration of an external function call - ExternalDecl =# 344 | @Uniontype ExternalDecl begin 345 | @Record EXTERNALDECL begin 346 | 347 | funcName #= The name of the external function =#::Option{Ident} 348 | lang #= Language of the external function =#::Option{String} 349 | output_ #= output parameter as return value =#::Option{Absyn.ComponentRef} 350 | args #= only positional arguments, i.e. expression list =#::List{Absyn.Exp} 351 | annotation_::Option{Annotation} 352 | end 353 | end 354 | 355 | #= - Equations =# 356 | @Uniontype Equation begin 357 | @Record EQUATION begin 358 | 359 | eEquation #= an equation =#::EEquation 360 | end 361 | end 362 | 363 | #= These represent equations and are almost identical to their Absyn versions. 364 | In EQ_IF the elseif branches are represented as normal else branches with 365 | a single if statement in them. =# 366 | @Uniontype EEquation begin 367 | @Record EQ_IF begin 368 | 369 | condition #= conditional =#::List{Absyn.Exp} 370 | thenBranch #= the true (then) branch =#::List{List{EEquation}} 371 | elseBranch #= the false (else) branch =#::List{EEquation} 372 | comment::Comment 373 | info::SourceInfo 374 | end 375 | 376 | @Record EQ_EQUALS begin 377 | 378 | expLeft #= the expression on the left side of the operator =#::Absyn.Exp 379 | expRight #= the expression on the right side of the operator =#::Absyn.Exp 380 | comment::Comment 381 | info::SourceInfo 382 | end 383 | 384 | @Record EQ_PDE begin 385 | 386 | expLeft #= the expression on the left side of the operator =#::Absyn.Exp 387 | expRight #= the expression on the right side of the operator =#::Absyn.Exp 388 | domain #= domain for PDEs =#::Absyn.ComponentRef 389 | comment::Comment 390 | info::SourceInfo 391 | end 392 | 393 | @Record EQ_CONNECT begin 394 | 395 | crefLeft #= the connector/component reference on the left side =#::Absyn.ComponentRef 396 | crefRight #= the connector/component reference on the right side =#::Absyn.ComponentRef 397 | comment::Comment 398 | info::SourceInfo 399 | end 400 | 401 | @Record EQ_FOR begin 402 | 403 | index #= the index name =#::Ident 404 | range #= the range of the index =#::Option{Absyn.Exp} 405 | eEquationLst #= the equation list =#::List{EEquation} 406 | comment::Comment 407 | info::SourceInfo 408 | end 409 | 410 | @Record EQ_WHEN begin 411 | 412 | condition #= the when condition =#::Absyn.Exp 413 | eEquationLst #= the equation list =#::List{EEquation} 414 | elseBranches #= the elsewhen expression and equation list =#::List{Tuple{Absyn.Exp, List{EEquation}}} 415 | comment::Comment 416 | info::SourceInfo 417 | end 418 | 419 | @Record EQ_ASSERT begin 420 | 421 | condition #= the assert condition =#::Absyn.Exp 422 | message #= the assert message =#::Absyn.Exp 423 | level::Absyn.Exp 424 | comment::Comment 425 | info::SourceInfo 426 | end 427 | 428 | @Record EQ_TERMINATE begin 429 | 430 | message #= the terminate message =#::Absyn.Exp 431 | comment::Comment 432 | info::SourceInfo 433 | end 434 | 435 | @Record EQ_REINIT begin 436 | 437 | cref #= the variable to initialize =#::Absyn.Exp 438 | expReinit #= the new value =#::Absyn.Exp 439 | comment::Comment 440 | info::SourceInfo 441 | end 442 | 443 | @Record EQ_NORETCALL begin 444 | 445 | exp::Absyn.Exp 446 | comment::Comment 447 | info::SourceInfo 448 | end 449 | end 450 | 451 | #= - Algorithms 452 | The Absyn module uses the terminology from the 453 | grammar, where algorithm means an algorithmic 454 | statement. But here, an Algorithm means a whole 455 | algorithm section. =# 456 | @Uniontype AlgorithmSection begin 457 | @Record ALGORITHM begin 458 | 459 | statements #= the algorithm statements =#::List{Statement} 460 | end 461 | end 462 | 463 | @Uniontype ConstraintSection begin 464 | @Record CONSTRAINTS begin 465 | 466 | constraints::List{Absyn.Exp} 467 | end 468 | end 469 | 470 | #= The Statement type describes one algorithm statement in an algorithm section. =# 471 | @Uniontype Statement begin 472 | @Record ALG_ASSIGN begin 473 | 474 | assignComponent #= assignComponent =#::Absyn.Exp 475 | value #= value =#::Absyn.Exp 476 | comment::Comment 477 | info::SourceInfo 478 | end 479 | 480 | @Record ALG_IF begin 481 | 482 | boolExpr::Absyn.Exp 483 | trueBranch::List{Statement} 484 | elseIfBranch::List{Tuple{Absyn.Exp, List{Statement}}} 485 | elseBranch::List{Statement} 486 | comment::Comment 487 | info::SourceInfo 488 | end 489 | 490 | @Record ALG_FOR begin 491 | 492 | index #= the index name =#::Ident 493 | range #= the range of the index =#::Option{Absyn.Exp} 494 | forBody #= forBody =#::List{Statement} 495 | comment::Comment 496 | info::SourceInfo 497 | end 498 | 499 | @Record ALG_PARFOR begin 500 | 501 | index #= the index name =#::Ident 502 | range #= the range of the index =#::Option{Absyn.Exp} 503 | parforBody #= parallel for loop body =#::List{Statement} 504 | comment::Comment 505 | info::SourceInfo 506 | end 507 | 508 | @Record ALG_WHILE begin 509 | 510 | boolExpr #= boolExpr =#::Absyn.Exp 511 | whileBody #= whileBody =#::List{Statement} 512 | comment::Comment 513 | info::SourceInfo 514 | end 515 | 516 | @Record ALG_WHEN_A begin 517 | 518 | branches::List{Tuple{Absyn.Exp, List{Statement}}} 519 | comment::Comment 520 | info::SourceInfo 521 | end 522 | 523 | @Record ALG_ASSERT begin 524 | 525 | condition::Absyn.Exp 526 | message::Absyn.Exp 527 | level::Absyn.Exp 528 | comment::Comment 529 | info::SourceInfo 530 | end 531 | 532 | @Record ALG_TERMINATE begin 533 | 534 | message::Absyn.Exp 535 | comment::Comment 536 | info::SourceInfo 537 | end 538 | 539 | @Record ALG_REINIT begin 540 | 541 | cref::Absyn.Exp 542 | newValue::Absyn.Exp 543 | comment::Comment 544 | info::SourceInfo 545 | end 546 | 547 | @Record ALG_NORETCALL begin 548 | 549 | exp::Absyn.Exp 550 | comment::Comment 551 | info::SourceInfo 552 | end 553 | 554 | @Record ALG_RETURN begin 555 | 556 | comment::Comment 557 | info::SourceInfo 558 | end 559 | 560 | @Record ALG_BREAK begin 561 | 562 | comment::Comment 563 | info::SourceInfo 564 | end 565 | 566 | #= MetaModelica extensions 567 | =# 568 | 569 | @Record ALG_FAILURE begin 570 | 571 | stmts::List{Statement} 572 | comment::Comment 573 | info::SourceInfo 574 | end 575 | 576 | @Record ALG_TRY begin 577 | 578 | body::List{Statement} 579 | elseBody::List{Statement} 580 | comment::Comment 581 | info::SourceInfo 582 | end 583 | 584 | @Record ALG_CONTINUE begin 585 | 586 | comment::Comment 587 | info::SourceInfo 588 | end 589 | end 590 | 591 | #= common prefixes to elements 592 | =# 593 | 594 | #= the visibility prefix =# 595 | @Uniontype Visibility begin 596 | @Record PUBLIC begin 597 | 598 | end 599 | 600 | @Record PROTECTED begin 601 | 602 | end 603 | end 604 | 605 | #= the redeclare prefix =# 606 | @Uniontype Redeclare begin 607 | @Record REDECLARE begin 608 | 609 | end 610 | 611 | @Record NOT_REDECLARE begin 612 | 613 | end 614 | end 615 | 616 | @Uniontype ConstrainClass begin 617 | @Record CONSTRAINCLASS begin 618 | 619 | constrainingClass::Absyn.Path 620 | modifier::Mod 621 | comment::Comment 622 | end 623 | end 624 | 625 | #= the replaceable prefix =# 626 | @Uniontype Replaceable begin 627 | @Record REPLACEABLE begin 628 | 629 | cc #= the constraint class =#::Option{ConstrainClass} 630 | end 631 | 632 | @Record NOT_REPLACEABLE begin 633 | 634 | end 635 | end 636 | 637 | #= the final prefix =# 638 | @Uniontype Final begin 639 | @Record FINAL begin 640 | 641 | end 642 | 643 | @Record NOT_FINAL begin 644 | 645 | end 646 | end 647 | 648 | #= the each prefix =# 649 | @Uniontype Each begin 650 | @Record EACH begin 651 | 652 | end 653 | 654 | @Record NOT_EACH begin 655 | 656 | end 657 | end 658 | 659 | #= the encapsulated prefix =# 660 | @Uniontype Encapsulated begin 661 | @Record ENCAPSULATED begin 662 | 663 | end 664 | 665 | @Record NOT_ENCAPSULATED begin 666 | 667 | end 668 | end 669 | 670 | #= the partial prefix =# 671 | @Uniontype Partial begin 672 | @Record PARTIAL begin 673 | 674 | end 675 | 676 | @Record NOT_PARTIAL begin 677 | 678 | end 679 | end 680 | 681 | @Uniontype ConnectorType begin 682 | @Record POTENTIAL begin 683 | 684 | end 685 | 686 | @Record FLOW begin 687 | 688 | end 689 | 690 | @Record STREAM begin 691 | 692 | end 693 | end 694 | 695 | #= the common class or component prefixes =# 696 | @Uniontype Prefixes begin 697 | @Record PREFIXES begin 698 | 699 | visibility #= the protected/public prefix =#::Visibility 700 | redeclarePrefix #= redeclare prefix =#::Redeclare 701 | finalPrefix #= final prefix, be it at the element or top level =#::Final 702 | innerOuter #= the inner/outer/innerouter prefix =#::Absyn.InnerOuter 703 | replaceablePrefix #= replaceable prefix =#::Replaceable 704 | end 705 | end 706 | 707 | #= - Elements 708 | There are four types of elements in a declaration, represented by the constructors: 709 | IMPORT (for import clauses) 710 | EXTENDS (for extends clauses), 711 | CLASS (for top/local class definitions) 712 | COMPONENT (for local variables) 713 | DEFINEUNIT (for units) =# 714 | @Uniontype Element begin 715 | @Record IMPORT begin 716 | 717 | imp #= the import definition =#::Absyn.Import 718 | visibility #= the protected/public prefix =#::Visibility 719 | info #= the import information =#::SourceInfo 720 | end 721 | 722 | @Record EXTENDS begin 723 | 724 | baseClassPath #= the extends path =#::Path 725 | visibility #= the protected/public prefix =#::Visibility 726 | modifications #= the modifications applied to the base class =#::Mod 727 | ann #= the extends annotation =#::Option{Annotation} 728 | info #= the extends info =#::SourceInfo 729 | end 730 | 731 | @Record CLASS begin 732 | 733 | name #= the name of the class =#::Ident 734 | prefixes #= the common class or component prefixes =#::Prefixes 735 | encapsulatedPrefix #= the encapsulated prefix =#::Encapsulated 736 | partialPrefix #= the partial prefix =#::Partial 737 | restriction #= the restriction of the class =#::Restriction 738 | classDef #= the class specification =#::ClassDef 739 | cmt #= the class annotation and string-comment =#::Comment 740 | info #= the class information =#::SourceInfo 741 | end 742 | 743 | @Record COMPONENT begin 744 | 745 | name #= the component name =#::Ident 746 | prefixes #= the common class or component prefixes =#::Prefixes 747 | attributes #= the component attributes =#::Attributes 748 | typeSpec #= the type specification =#::Absyn.TypeSpec 749 | modifications #= the modifications to be applied to the component =#::Mod 750 | comment #= this if for extraction of comments and annotations from Absyn =#::Comment 751 | condition #= the conditional declaration of a component =#::Option{Absyn.Exp} 752 | info #= this is for line and column numbers, also file name. =#::SourceInfo 753 | end 754 | 755 | @Record DEFINEUNIT begin 756 | 757 | name::Ident 758 | visibility #= the protected/public prefix =#::Visibility 759 | exp #= the unit expression =#::Option{String} 760 | weight #= the weight =#::Option{ModelicaReal} 761 | end 762 | end 763 | 764 | #= - Attributes =# 765 | @Uniontype Attributes begin 766 | @Record ATTR begin 767 | arrayDims #= the array dimensions of the component =#::Absyn.ArrayDim 768 | connectorType #= The connector type: flow, stream or nothing. =#::ConnectorType 769 | parallelism #= parallelism prefix: parglobal, parlocal, parprivate =#::Parallelism 770 | variability #= the variability: parameter, discrete, variable, constant =#::Variability 771 | direction #= the direction: input, output or bidirectional =#::Absyn.Direction 772 | isField #= non-fiel / field =#::Absyn.IsField 773 | mode::Bool 774 | end 775 | end 776 | 777 | #= Parallelism =# 778 | @Uniontype Parallelism begin 779 | @Record PARGLOBAL begin 780 | 781 | end 782 | 783 | @Record PARLOCAL begin 784 | 785 | end 786 | 787 | @Record NON_PARALLEL begin 788 | 789 | end 790 | end 791 | 792 | #= the variability of a component =# 793 | @Uniontype Variability begin 794 | @Record VAR begin 795 | 796 | end 797 | 798 | @Record DISCRETE begin 799 | 800 | end 801 | 802 | @Record PARAM begin 803 | 804 | end 805 | 806 | @Record CONST begin 807 | 808 | end 809 | end 810 | 811 | #= /* adrpo: previously present in Inst.mo */ =# 812 | 813 | #= the initial attribute of an algorithm or equation 814 | Intial is used as argument to instantiation-function for 815 | specifying if equations or algorithms are initial or not. =# 816 | @Uniontype Initial begin 817 | @Record INITIAL begin 818 | 819 | end 820 | 821 | @Record NON_INITIAL begin 822 | 823 | end 824 | end 825 | 826 | const defaultPrefixes = PREFIXES(PUBLIC(), NOT_REDECLARE(), NOT_FINAL(), Absyn.NOT_INNER_OUTER(), NOT_REPLACEABLE())::Prefixes 827 | 828 | const defaultVarAttr = ATTR(list(), POTENTIAL(), NON_PARALLEL(), VAR(), Absyn.BIDIR(), Absyn.NONFIELD(), false)::Attributes 829 | 830 | const defaultParamAttr = ATTR(list(), POTENTIAL(), NON_PARALLEL(), PARAM(), Absyn.BIDIR(), Absyn.NONFIELD(), false)::Attributes 831 | 832 | const defaultConstAttr = ATTR(list(), POTENTIAL(), NON_PARALLEL(), CONST(), Absyn.BIDIR(), Absyn.NONFIELD(), false)::Attributes 833 | 834 | #= So that we can use wildcard imports and named imports when they do occur. Not good Julia practice =# 835 | @exportAll() 836 | end 837 | --------------------------------------------------------------------------------