Generating Code Automatically

User Defined Grammars
 
Automatic Problem Solver 3.0 allows you to design User Defined Grammars so that the models evolved by APS in its native Karva language can be automatically translated into the programming language of your choice if you happen to prefer a programming language not already covered by the eight built-in grammars of APS 3.0 (C, C++, C#, Visual Basic, VB.Net, Java, Java Script, and Fortran).

APS 3.0 allows you to define as many grammars as you wish. The design of an extra grammar in APS 3.0 is very easy, since it can be done by using one of the eight built-in grammars of APS 3.0 as a starting point. As an illustration, the C++ grammar of APS 3.0 is shown here. Then you just have to define correctly in this new language all the mathematical functions and rules used by APS 3.0.

After a new grammar is created, it must be saved into a xml file. Then this file must be copied into the directory Grammars of APS 3.0. After that you’ll be able to translate all the models evolved by APS 3.0 into this new language.

To translate your model into this new language, on the Automatic Problem Solver modeling environment, select the Model Panel, and then, on the Language list box, select the name you gave to your new language.

The code created with this new language can then be copied to the clipboard or saved to disk.

Home | Contents | Previous | Next