Initial import

git-svn-id: https://svn.jmodelica.org/trunk@1 7ae51c65-13d5-4921-9d80-6511ddd1419c
Initial import

git-svn-id: https://svn.jmodelica.org/trunk@2 7ae51c65-13d5-4921-9d80-6511ddd1419c
Cleaning up

git-svn-id: https://svn.jmodelica.org/trunk@3 7ae51c65-13d5-4921-9d80-6511ddd1419c
Setting ignore-patterns

git-svn-id: https://svn.jmodelica.org/trunk@4 7ae51c65-13d5-4921-9d80-6511ddd1419c
Just testing

git-svn-id: https://svn.jmodelica.org/trunk@5 7ae51c65-13d5-4921-9d80-6511ddd1419c
Removing unnecessary dirs

git-svn-id: https://svn.jmodelica.org/trunk@6 7ae51c65-13d5-4921-9d80-6511ddd1419c
Setting svn:ignore

git-svn-id: https://svn.jmodelica.org/trunk@7 7ae51c65-13d5-4921-9d80-6511ddd1419c
Cleaning up

git-svn-id: https://svn.jmodelica.org/trunk@8 7ae51c65-13d5-4921-9d80-6511ddd1419c
Applied JModelica-mspiegel2.patch  and JModelica-mspiegel.patch

git-svn-id: https://svn.jmodelica.org/trunk@9 7ae51c65-13d5-4921-9d80-6511ddd1419c
Removed eclipse specific files

git-svn-id: https://svn.jmodelica.org/trunk@10 7ae51c65-13d5-4921-9d80-6511ddd1419c
Minor for testing SVN

git-svn-id: https://svn.jmodelica.org/trunk@11 7ae51c65-13d5-4921-9d80-6511ddd1419c
Added the collection attributes parameters and structuralParameters for a FClass.

git-svn-id: https://svn.jmodelica.org/trunk@12 7ae51c65-13d5-4921-9d80-6511ddd1419c
Fixed problem with non-deterministic order of generated connect equations.

git-svn-id: https://svn.jmodelica.org/trunk@13 7ae51c65-13d5-4921-9d80-6511ddd1419c
Improved implementations in FlatAPI.jrag

git-svn-id: https://svn.jmodelica.org/trunk@14 7ae51c65-13d5-4921-9d80-6511ddd1419c
Added lookup of FIdUseExp in the instance hierarchy.

git-svn-id: https://svn.jmodelica.org/trunk@15 7ae51c65-13d5-4921-9d80-6511ddd1419c
This is a commit of the patch JModelica-mspiegel-20080316.patch. The code has been
changed according to the comments below. The type checking and the static evaluation
framework designs are under discussion, but is commited in order to faciliate discussions.

- In Arrays.jrag

	inh boolean FIdUseExp.inArraySubscripts();
	eq FArraySubscripts.getChild().inArraySubscripts() = true;
	eq Root.getChild().inArraySubscripts() = false;

is removed, or moved?
 

Changes:

  + Added the attribute.


-------------------------------------------------------------------------
- In Connections.jrag

Added import of linked HashSet

OK

-------------------------------------------------------------------------
- In ErrorCheck.jadd

Removed everything in favor of a new error checking framework in
ErrorCheck.jrag. Checking of

   - FullClassDecl
   - ComponentDecl

missing?

  - Add line numbers.

Changes:
  + Line numbers supported
  + Inserted the existing mechanisms for flow control of error
    checking in the new framework
  + Formatted the error output 

-------------------------------------------------------------------------
- In FlatModelica.ast

Minor changes.

OK
-------------------------------------------------------------------------
- In FlatNameBinding.jrag

If the name checking of the source code is ok, there should be no need
for checking flat names. I guess that the reason to introduce this
facility is that we would like to read flat modelica-files that may
contain errors that needs to be checked. Correct?

It is ok that SourceRoot can contain FExp:s since instance trees are
defined as NTA:s of BaseClassDecl.

The framework has to be merged with existing name binding for flat
names in the compiler. In order to lookup names also in the instance
hierarchy, lookup needs to be parametrized with FQName instead of
String. The solution with HasMap is very good - should be considered
for regular name lookup as well? 

Regarding error checking it would be cleaner to have it in a separate
aspect, rather than in the actual name binding methods. This will be
difficult to enforce when checking errors in the instance tree,
however.

I am not totally happy with the introduction of FAbstractVariable. It
is inconvenient to have to always consider this case of FUndefVariable
since it gives rise to explicit casts or additional equation
definitions. Since the flat representation should be consistent after
error checking of the source code, I don't really see the need for
checking the same thing again in the flat representation. If, after
all, checking is needed, I would prefer a more lightweight solution
where null is returned if no declaration is found, and where error
checking could be turned on and off. 

Changes:
  + Made the new name binding framework consistent with the existing
    framework: renames decl() -> myFV() and lookup() -> lookupFV().
  + lookupFV is now parameterized by FQName instead of String in order
    to allow lookups in the instance hierarchy.

Open issues:
  + Should name checking be performed at all?
  + Is FAbstractVariable needed?


-------------------------------------------------------------------------
- In Flattening.jrag

The line
  
    r.printIVarAccesses("");

in FullClassdecl.findFlatten() is removed. Probably because it was
added after the revision on which the patch is based. No problem.

The rest is changes in order to accomodate the updated type checking
framework.

Changes:
  + Added the missing line.
-------------------------------------------------------------------------
- In FlatTypeCheck.jrag

I think that it is ok to send unfinished code since it promotes
discussions. Adding a comment of the purpose of the code would be
helpful though :-).

-------------------------------------------------------------------------
- In FlatTypeSystem.ast

AST nodes for the flat type checking framework

-------------------------------------------------------------------------
- In FlatTypeSystem.jrag

  - Checking and type computations is done at the same time. Should be
    separated?
  - Lots of instanceof, introduction of attributes to avoid this?

  - Instead of introducing singleton flat type objects, use the
    strategy employed in the compiler front-end. There, the redefined
    types Real, Integer etc are defined as NTAs of Program:

Program ::= Element* 
            /UnknownClassDecl/
            /UnknownComponentDecl/
            /PredefinedType:ClassDecl*/ 
            /BuiltInType:ClassDecl*/   
            /BuiltInFunction:ClassDecl*/
            /LibNode*/;
  
    The NTAs are then defined by syn lazy attributes:

syn lazy List Program.getPredefinedTypeList() {...

    Since the attribute is lazily defined, only one object is created for
    each predefined type. In addition, the types are *in a tree*, which is
    essential.






-------------------------------------------------------------------------
- In FlatVariability.jrag

  - Looks ok, need to check it some more.

-------------------------------------------------------------------------
- In Modelica.ast
  
  - Changed the definition of PowExp.

OK.

-------------------------------------------------------------------------
- In NameCheck.jadd

  - Just updated to the new error framework

OK.

-------------------------------------------------------------------------
- In PrettyPrint.jrag
  
  - Minor changes to make consistent with other changes.

  - Additional printout of evaluated bindingexp made tests fail
    + Changed so that the evaluated value is in a comment.

OK.

Changes:
  + Moved extra printout of evaluated values to comment. Otherwise
    the test suite fails.

-------------------------------------------------------------------------
- in SingletonTypes.jrag

  - Support for singleton types, their variability etc.

-------------------------------------------------------------------------
- In StaticValueEval.ast

  - AST nodes for the evaluation framework.

-------------------------------------------------------------------------
- In StaticValueEval.jrag

  - In FVariable.staticValue: If there is no binding exp, there should
    at least be a warning, possibly an error. There was a discussion
    about this on the design list, check.

  - Static evaluation of 'time' should probably not return 0.0. Say
    that we have a time variable system \dot x = f(x(t),t), then the 
    time of evaluation should be specified. On the other hand,
    expressions containing time should have higher variability.

  - Declaring staticValue() as lazy may not be ideal. It should be possible
    interact with an FClass, e.g. change the value of a parameter,
    reevaluate etc. 

  - If evaluation is not done lazily, a lot of objects of type
    FlatStaticValue are created, and must accordingly be garbage
    collected. One application that may require a lot of evaluations
    is integration of the differential equation by means of
    interpretation. In this case, we definitely need to be able to
    change parameter values. Also, it would be desireble to have a 
    "leaner" evaluation framework that did not produce a lot of
    garbage. I am currently contemplating this issue. The evaluation
    framework is crusial, since it will eventually evolve to a CAS
    (computer algebra system) including matrix algebra and
    symbolic/automatic differentiation. 

-------------------------------------------------------------------------
- In Util.jrag
   
   - Minor.

OK.
-------------------------------------------------------------------------
- In FlattenModel.java

  - Clean up and added flat error checking

OK.
-------------------------------------------------------------------------
- In FlattenModelHotStart.java

  - Clean up and added flat error checking

OK.
-------------------------------------------------------------------------
- In FlatteningTestCase.java

  - Clean up and added flat error checking

OK.
-------------------------------------------------------------------------

General comments

- Test cases must be added! Johan should update the test-framework:
  + Annotations should be rewritten to dedicated AST-nodes
  + Convert test annotations to vendor specific annotations
  + Enable test of flat models (read from file)
  + Enable test cases which are errouneous (check acutal error text)

- The test suites did not pass.


Remaining problems
  + The test cases NameTests1.ImportTest1 and NameTests.ImportTest5
    fails. Have not found out why.
    If errorCheck() is run instead of checkErrorsInClass(cl) in
    FlattenModel, we get incorrect results for 
    > scripts/linux/flattenmm src/test/modelica/NameTests.mo NameTests.ImportTest1
		      

git-svn-id: https://svn.jmodelica.org/trunk@16 7ae51c65-13d5-4921-9d80-6511ddd1419c
git-svn-id: https://svn.jmodelica.org/trunk@17 7ae51c65-13d5-4921-9d80-6511ddd1419c
Added one more file

git-svn-id: https://svn.jmodelica.org/trunk@18 7ae51c65-13d5-4921-9d80-6511ddd1419c
Added a todo list.

git-svn-id: https://svn.jmodelica.org/trunk@19 7ae51c65-13d5-4921-9d80-6511ddd1419c
- Added a sketch for how FPrimitiveTypes can be created and inserted in InstRoot and FClass
- FVariable is now defined as an NTA of InstPrimitive and moved to an FClass during flattening. 
Whether or not this is a good idea must be comtemplated some more.

git-svn-id: https://svn.jmodelica.org/trunk@22 7ae51c65-13d5-4921-9d80-6511ddd1419c