========
Function
========

This grammar adds extensions to Modelica to accommodate the FUSED pub/sub
framework. It processes several Modelica and/or FUSED directory files in
command-line order, passing definitions from earlier files on in an
environment for reference in later files.

====================
Syntactic extensions
====================

This grammar parses an extended version of Modelica that allows for
placing FUSED publication or subscription statements on variable
declarations. When an extended file is processed it will produce a
translation to unextended Modelica (a "host translation") and also a
FUSED directory containing any published variables.

* Publication statement: A FUSED publication statement may appear
after the declaration of any initialized variable; for example:

     Real x = 4 { FUSED_Publish : foo.bar };

This translates to the same declaration without the publication statement:

     Real x = 4;

and also outputs a FUSED variable named 'foo.bar' to the FUSED
directory with a value of 4.

* Subscription statement: A FUSED subscription statement may appear
after the declaration of any *un*initialized variable. For example:

     Real y { FUSED_Subscribe : baz.qux };

The translator will then look in the input FUSED directory for a FUSED
variable named 'baz.qux', and translate the variable declaration with
the subscription statement to an initialized declaration. For example,
supposing it finds that variable 'baz.qux' has a value of 7, the
declaration above will translate to

     Real y = 7;

=====
Usage
=====

% java -jar modelica.jar [FUSED or Modelica files]

* If a file has the extension '.mo.fused', its host-language
translation is output to a file with the same name but the extension
'.mo'. If it contains any FUSED publication statements, a FUSED
publication directory for the file is also output, with the same name
but the extension '.xml.fused'.
* If a file has the extension '.xml.fused', it is read as a FUSED
publication directory and its variables made available for subscription.
* Otherwise, the file is checked for syntactic and semantic errors, but
no output is produced.