Earlier discussion: D147131
For function, it is just a grammar sugar of class-based subroutines.
For lambda, it is a anonymous function with captured variables.
Grammar:
function
function name(type arg0, ...): type { assert xxx, ""; defvar xxx = xxx; return xxx; }
lambda
function(type arg0, ...): type { ... }
Only assert, defvar and return are allowed. Each function
should return a value.
Function types are represented as function<rettype[, argtype]*>,
and rettype is mandatory. Function types can be used in field,
arguments or foreach iterator.
Recursive function is supported and we can also return a function
(or lambda) value in a function.
The function can be called with funcname(args). However, there
is a grammar ambiguity between DAG and function call. To distinguish
them, calls inside DAGs should add a single quote before arguments,
like funcname'(args).
Please see llvm/docs/TableGen/ProgRef.rst for more details.
More usage: D149017
The list of keywords should be sorted.