Language

Section: Misc. Reference Manual Pages (Description)
Index Return to Main Contents

 6 "IRIT Version 6.0"   

NAME

Language Description

The front end of the IRIT solid modeler is an infix parser that mimics some of the C language behavior. The infix operators that are supported are plus (+), minus (-), multiply (*), divide (/), and power (^), for numeric operators, with the same precedence as in C.

However, unlike the C language, these operators are overloaded, or different action is taken, based upon the different operands. This means that one can write '1 + 2', in which the plus sign denotes a numeric addition, or one can write 'PolyObj1 + PolyObj2', in which case the plus sign denotes the Boolean operation of a union between two geometric objects. The exact way each operator is overloaded is defined below.

In this environment, reals, integers, and even Booleans, are all represented as real types. Data are automatically promoted as necessary. For example, the constants TRUE and FALSE are defined as 1.0 and 0.0 respectively.

Each expression is terminated by a semicolon. An expression can be as simple as 'a;' which prints the value of variable a, or as complex as:


    for ( t = 1.1, 0.1, 1.9,
            cb1 = csurface( sb, COL, t ):
            color( cb1, green ):
            snoc( cb1, cb_all )
        );

While an expression is terminated with a semicolon, a colon is used to terminate mini-expressions within an expression.

Once a complete expression is read in (i.e., a semicolon is detected) and parsed correctly (i.e. no syntax errors are found), it is executed. Before each operator or a function is executed, parameter type matching tests are made to make sure the operator can be applied to these operand(s), or that the function gets the correct set of arguments.

The parser is totally case insensitive, so Obj, obj, and OBJ will refer to the same object, while MergePoly, MERGEPOLY, and mergePoly will refer to the same function.

Objects (Variables if you prefer) need not be declared. Simply use them when you need them. Object names may be any alpha-numeric (and underscore) string of at most 30 characters. By assigning to an old object, the old object will be automatically deleted and if necessary its type will be modified on the fly.

Example:


    V = sin( 45 * pi / 180.0 );
    V = V * vector( 1, 2, 3 );
    V = V * rotx( 90 );
    V = V * V;

will assign to V a NumericType equal to the sine of 45 degrees, the VectorType ( 1, 2, 3 ) scaled by the sine of 45, rotate that vector around the X axis by 90 degrees, and finally a NumericType which is the dot (inner) product of V with itself.

The parser will read from stdin, unless a file is specified on the command line or an INCLUDE command is executed. In both cases, when the end of file is encountered, the parser will again wait for input from stdin. In order to execute a file and quit in the end of the file, put an EXIT command as the last command in the file.


 

Index

NAME

This document was created by man2html, using the manual pages.
Time: 07:27:19 GMT, October 17, 2022