<o3prm> ::= [<header>] <compilation_unit> [(<compilation_unit>)]
<header> ::= <import>
<import> ::= import <path> ";"
<compilation_unit> ::= <type_unit> |
<class_unit> |
<system_unit>
<type_unit> ::= type <word> <type_body>
<type_body> ::= <basic_type> | <subtype>
<basic_type> ::= <labelized_type> | <integer_type> | <real_type>
<labelized_type> ::= labels "(" <word> ( "," <word> )+ )"
<integer_type> ::= int "(" <integer> "," <integer> ")"
<real_type> ::= real "(" <float> "," <float> ( "," <float> )+ ")"
<subtype> ::= extends <path> "(" <word> ":" <word> ( "," <word>)+ ")"
<class_unit> ::= <class> | <interface>
<class> ::= class <word> [ extends <path> ] "{" <class_elt>* "}"
<class_elt> ::= <reference_slot> | <attribute> | <parameter>
<interface> ::= interface <word> [ extends <path> ] "{" <interface_elt> "}"
<interface_elt> ::= <reference_slot> | <abstract_attr>
<reference_slot> ::= [internal] <word> [ "[" "]" ] <word> ";"
<attribute> ::= <attribute_type> <attribute_name> <attribute_cpt> ";"
<attribute_type> ::= <anonymous_type> | <word>
<anonymous_type> ::= <labelized_type> | <integer_type> | <real_type>
<attribute_name> ::= <word> [ <dependency> ]
<attribute_cpt> ::= ( <CPT> | <aggregator> )
<dependency> ::= dependson <path> ( "," <path> )*
<abstract_attr> ::= <word> <word> ";"
<CPT> ::= "{" ( <raw_CPT> | <rule_CPT> ) "}"
<raw_CPT> ::= "[" <cpt_cell> ( "," <cpt_cell> )+ "]"
<rule_CPT> ::= ( <word> ("," <word>)* ":" <cpt_cell> ";" )+
<cpt_cell> ::= <float> | """ <formula> """
<formula> ::= <real> | <function> | <formula> <operator> <formula>
<function> ::= <function_name> "(" <formula> ")"
<function_name> ::= exp | log | ln | pow | sqrt
<parameter> ::= param ( <int_parameter> | <real_parameter> )
<int_parameter> ::= "int" <word> default <integer> ";"
<real_parameter> ::= "real" <word> default <float> ";"
<aggregator> ::= ( "=" | "~" ) <word> "(" <parents>, <args> ")"
<parents> ::= ( <parent> | "[" <parent> (, <parent> )* "]" )
<args> ::= <word> ( "," <word> )*
<parent> ::= [ "(" <path> ")"] <path>
<system> ::= system <word> "{" <system_elt>* "}"
<system_elt> ::= <instance> | <assignment>
<instance> ::= <path> [ "[" digit* "]" ] <word> ";"
<instance> ::= <path> <word> "(" <parameters> ")" ";"
<parameters> ::= instanceParameter ("," instanceParameter)*
<instanceParameter> ::= <word>"="(<integer>|<float>)
<assignment> ::= <path> += <word> ";" |
<path> = <word> ";"
<word> ::= <letter> (<letter> | <digit>)
<letter> ::= 'A'..'Z' + 'a'..'z'+ '_'
<integer> ::= <digit> <digit>*
<float> ::= <integer> "." <integer>
<digit> ::= '0'..'9'
<path> ::= ["(" ")"] <word> [ ( "." <word> ) ]