Fawk - datasheet
Language characteristics
Fawk is an AWK dialect.
Fawk is an imperative programming language. Libfawk implements
a compiler and a custom VM as a tiny, as a reentrant ANSI/C89 library.
Fawk supports:
- the common awk features: variables, functions, if(), for(), do-while, while()
- data types: NIL, number (normally double precision floating point), string and function reference
- arrays indexed with any type (implemented as hash table)
- array-in-array
- for(in) for iterating over the members of an array; the body of the loop may change the array
- fake multi-dimensional arrays using the usual AWK trick of SUBSEP
- an alternate struct-like array syntax
- include for including other fawk sources
- variable argument (vararg) functions
- text-block, a multiline template-like string "literal" type with expression inserts
What fawk does not have compared to standard awk
- I/O: no getline, no print, no redirections (the host application may
provide these through functions)
- input processing: no BEGIN, no END, no pattern matches, only functions
- field splitting: there's no $0, $1, NF, IFS, OFS
- most builtin awk standard functions (regex, math) are missing: the host
application may define them
- historical syntax corner cases: there's no function call without (), no
invisible string concatenation operator
- no liberal policy on semicolons: a statement must
be terminated with a semicolon (it's like in C)
- no break or continue statement in loops (yet?)
What extras fawk offers over standard awk
- support for the include keyword (requires a few lines of host
application support)
- support for array-in-array
- support for alternative array syntax of arr.idx for using array as struct
- functions are first-class objects: references to functions can be stored
in variables and arrays, they also can be passed as function arg
- explicit operator @ for string concatenation
- array references can be compared for figuring if they are referring to the same array
- isarray() builtin and optional explicit A[] array declarator; whether
function parameters are arrays are determined runtime: it is possible to
write a function that accepts either array or scalar