Skip to main content Skip to navigation

Syntax summary

expression:
        primary-expression
        - expression
        ! expression
        & lvalue
        expression #
        ++ lvalue
        lvalue ++
        -- lvalue
        lvalue --
        [ expression-listopt ]
        expression binop expression
        expression ? expression : expression
        lvalue asgnop expression

primary-expression:
        lvalue
        ( expression )
        primary-expression [ expression ]
        primary-expression ( expression-listopt )

lvalue:
        identifier
        $
        $number
        lvalue [ expression ]
        * expression
        ` expression `
        ( lvalue )

expression-list:
        expression
        expression , expression-list

statement:
        expression ;
        function-definition
        formula-definition
        action-specification
        dependency-link
        query-command
        compound-statement
        insert lvalue , expression-1 , expression-2 ;
        append lvalue , expression ;
        delete lvalue , expression ;
        shift lvalueopt ;
        if ( expression ) statement
        if ( expression ) statement else statement
        while ( expression ) statement
        do statement while ( expression ) ;
        for ( expressionopt ; expressionopt ; expressionopt ) statement
        switch ( expression ) statement
        case constant : statement
        default : statement
        break ;
        continue ;
        return expressionopt ;
        ;

compound-statement:
        { statement-listopt }

statement-list:
        statement
        statement  statement-list

function-definition:
        function-declarator  function-body

function-declarator:
        func identifier
        proc identifier

function-body:
        { para-aliasopt  local-var-declopt  statement-listopt }

para-alias:
        para identifier-listopt ;

local-var-decl:
        auto identifier-listopt ;

identifier-list:
        identifier
        identifier , identifier-list

action-specification:
        function-declarator dependency-list function-body

dependency-list:
        : identifier-list

dependency-link:
        identifier ~> [ identifier ] ;

query-command:
        ? lvalue ;

Operator Precedence

The primary-expression operators

()        []    ``

have highest priority and group left-to-right. The unary operators

*        &    -    !    not    #    ++    --

have priority below the primary operators but higher than any binary operator, and group right-to-left.

Binary priority decreasing as indicated below.

binop:
        *    /    %
        +    -    //
        >    <    >=    <=
        ==    !=
        &&    and
        ||    or

The conditional operator

?:

has priority lower than the binary operators, and groups right-to-left.

Assignment operators all have the same priority, and all group right-to-left.

asgnop:
        =    +=    -=