Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Formula Node Syntax

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

The Formula Node syntax is similar to the syntax used in text-based programming languages. Remember to end assignments with a semicolon (;) as in C. Use scope rules to declare variables in Formula Nodes. Also, keep in mind the precedence of operators in the Formula Node.

The Formula Node syntax is summarized below using Backus-Naur Form (BNF notation). The summary includes non-terminal symbols: compound-statement, identifier, conditional-expression, number, array-size, floating-point-type, integer-type, left-hand-side, assignment-operator, and function. Symbols in red bold monospace are terminal symbols given exactly as they should be reproduced. The symbol # denotes any number of the term following it.

statement-list:

statement ;
statement ; statement-list

statement:

variable-declaration
assignment
compound-statement
conditional-statement
iterative-statement
switch-statement
control-statement

variable-declaration:

type-specifier identifier
type-specifier identifier array-index-list
type-spec identifier = assignment

array-index-list:

[integer-constant]
[integer-constant]array-index-list

type-specifier:

floating-point-type
integer-type

floating-point-type:

float
float32
float64

integer-type:

int
int8
int16
int32
uInt8
uInt16
uInt32

assignment:

expression
left-hand-side assignment-operator assignment

expression:

expression binary-operator expression
unary-operator expression
expression unary-operator
expression ? expression : expression
( expression )
identifier
constant
function-name ( argument-list )

left-hand-side:

identifier
identifier array-subscription

array-subscription:

[assignment]
[assignment] array-subscription

assignment-operator: one of

= += –= *= /= >>= <<= &= ^= |= %= **=

binary-operator: one of

+ – * / ^ != == > < >= <= && || & | % **

unary-operator: one of

+ – ! ++ –– ~

argument-list:

expression
expression , argument-list

constant:

pi
number

compound-statement:

{ statement-list }

conditional-statement:

if-statement
if-else-statement

if-statement:

if ( assignment ) statement

if-else-statement:

if-statement else statement

iterative-statement:

do-statement
for-statement
while-statement

do-statement:

do statement while ( assignment )

while-statement:

while ( assignment ) statement

for-statement:

for ( [assignment] ; [assignment] ; [assignment] ) statement

control-statement:

break
continue

switch-statement:

switch ( assignment ) { case-statement-list }

case-statement-list:

case-statement
case-statement-list case-statement

case-statement:

case number : statement-list
default : statement-list

non-digit: one of

_ a~z A~Z

digit: one of

0 1 2 3 4 5 6 7 8 9

nonzero-digit: one of

1 2 3 4 5 6 7 8 9

binary-digit: one of

0 1

octal-digit: one of

0 1 2 3 4 5 6 7

hex-digit: one of

0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F

identifier:

non-digit [non-first-character]

non-first-character:

non-digit [non-first-character]
digit [non-first-character]

number:

integer-constant
float-constant

integer-constant:

decimal-constant
binary-constant
octal-constant
hex-constant

decimal-constant:

nonzero-digit #digit

binary-constant:

0b #binary-digit
0B #binary-digit

octal-constant:

0 #octal-digit

hex-constant:

0x #hex-digit
0X #hex-digit

float-constant:

fraction exponent-part
decimal-constant exponent-part

fraction:

#digit . digit #digit

exponent-part:

e [sign] #digit
E [sign] #digit

sign: one of

+ -

comment:

//comment
/* comment */


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit