Formula Node syntax is similar to the syntax used in text-based programming languages. Remember to end assignments with a semicolon (;) as in C. The Formula Node syntax is summarized below using Backus-Naur Form (BNF notation). Square brackets enclose optional items.
<stmtList> := <stmt> | <stmtList> <stmt>
<stmt> : = <assignment> ; | <varDecl> ; | <compoundStmt>
| <condStmt> | <iterativeStmt> | <swithcStmt> | <controlStmt> | ;
<varDecl> : = <typeSpec> <identifier> [ [<arrIndexList> ] ]
| <typeSpec> <identifier> = <condExpr>
| <varDecl> <typeSpec> IDENT [ "["<arrIndexList> "]" ]
| <varDecl> <typeSpec> IDENT =<condExpr>
<arrIndexList> : = NUM | <arrIndexList> ] [ <arrSize>
<typeSpec> : = <floatType> |<intType>
<assignment>: = <expr> | <leftHandSide> <asgnOP> <assignment>
<expr> : = <expr> <binaryoperator> <expr>
| <unaryoperator> <expr>
| <expr> ? <expr> : <expr>
| ( <expr>)
| <identifier>
| <const>
| <function> ( <arglist> )
<binaryoperator>:= + | - | * | / | ^ | != | = = | > | < | >= | <= | && | || | & | | | ^
<unaryoperator>: = + | - | !
<arglist>: =<aexpr> [ , <arglist> ]
<const>: =pi | <number>
<condStmt> : = <ifStmt> | <ifElseStmt>
<ifElseStmt> : = <ifStmt> else <stmt>
<ifStmt> : = if ( <assignment> ) <stmt>
<iterativeStmt> : = <doStmt> | <forStmt> | <whileStmt>
<doStmt> : = do <stmt> while ( <expression> ) ;
<whileStmt> : = while ( <assignment> ) <stmt>
<forStmt> : = for ( [<assignment>] ; [<assignment>]
; [<assignment>] ) <stmt>
<controlStmt> := break; | continue;
<switchStmt> := switch (<expr>) { <caseStmtList> }
<caseStmtList> := <caseStmt> | <caseStmtList> <caseStmt>
<caseStmt> := case NUM : <stmtList> | default : <stmtList>