Users interact with Risk Calc by entering expressions in its scripting language into the Listener for evaluation. This scripting language's syntax is intended to be forgiving and flexible so that meaningful expressions entered by users will almost always be correctly interpreted and evaluated. Risk Calc understands many conventions familiar to both engineers and risk analysts, and to both C and Pascal programmers. Many checks are built into Risk Calc to ensure that its evaluations are sensible and correct. For instance, variables are strongly typed to reduce computational errors, but they are dynamically typed, which means users can change a variable's type just by changing its value. In addition to typing, Risk Calc can also recognize and make use of the physical units of any quantity. This allows Risk Calc to do several other checks that are not generally possible in other programming languages or calculation systems. Risk Calc's syntax can be described formally in (download here) extended Backus−Naur form and "railroad diagrams". See also the PowerPoint presentation bnf.ppt attached at the bottom of this page.
Below is review of the central features of the language, including a shallow review of the syntax diagrams for the Risk Calc scripting language. Apologies and shout-outs to Wirth, Dijkstra, Backus, Naur and Pāṇini.
Risk Calc scripts
Interpreted (not compiled), even in batch mode
Flexible and forgiving syntax
Both C and Pascal structures allowed
Shallowly structured
Looping, blocking, user routines, but no formal variables
Dimensional units, but not strongly typed
Type errors usually found at run-time
Very high-level language
Numeric quantities (in gray boxes) may be based on either real or logical values.
integers ⊂ reals ⊂ intervals ⊂ p-boxes
integers ⊂ reals ⊂ intervals ⊂ fuzzy numbers
integers ⊂ reals ⊂ probability distributions ⊂ p-boxes
Types and dimensions
Any variable can hold any numeric quantity or string
Variables don’t have fixed types and a variable’s type can change during execution
Numeric quantities have optional units which restrict permissible operations according to dimensional rules
A variable that has not yet been defined evaluates to its own name (as a string)
Type and unit casting, if possible, is automatic
Impossible castings precipitate error messages
All numerical quantities can have units in arbitrary dimensions.