2.16. Functional Expression Declaration

Figure 2.27. Concrete Syntax for Functional Expression Declaration

[112] <fun> ::= "fun" <fun-id> "(" <fun-params>? ")" "returns" <basic-type> "=" <exp> ";"  
[113] <fun-params> ::= <basic-type> <fun-local-id> ("," <basic-type> <fun-local-id>)*  

BIR features functional expression usually found in functional programming languages such as SML. Functional expressions can be recursive and are useful, for example, to express sophisticated heap properties because data structures are usually recursive (or mutually recursive). Since BIR expressions are side-effect free, thus, functional expressions are also side-effect free. BIR currently only support first-order functions; more advanced features may be added in the future. Figure 2.27, “Concrete Syntax for Functional Expression Declaration” presents the concrete syntax for functional expression declaration.

Namespace. The namespace for functional expressions is the global namespace that is shared with constants, enumerations, records, extensions, type-aliases, threads and functions, and virtual tables.

Abstract Syntax Tree. 

Figure 2.28. Java AST for Functional Expression Declaration

Java AST for Functional Expression Declaration
[ .gif, .svg ]

The Java AST class for functional expression declaration is the Fun class.