About libfawk
Libfawk is a very small, reentrant, portable (pure C89) library that implements the fawk Virtual Machine (VM) for executing scritps. The implementation is very small (less than 1700 sloc) and as an option shipped as a single-file dependency-free .c source (with or without language compilers appended) that is very easy to integrate in any project. Libfawk is reentrant, which means multiple independent script contexts can exist and be used in parallel without having to use processes or threads. Libfawk has the following scripting langauge options available:
- Fawk is an AWK dialect that focuses on functions and is designed exclusively for embedded scripting.
- Fbas is a third-generation BASIC dialect that supports structured programming and is also designed for embedding.
- Fpas is a custom Pascal dialect covering the same feature set as fawk.
The compacted single-source version of each parser is less than 1000 sloc.
Small size allows users to learn each language in an hour using the tutorials: the multi-language fawk tutorial. The libfawk API is small and simple, which makes host application development easy.
Small size in numbers:
| library version (#include from /usr/include, link) | |||
|---|---|---|---|
| component | edit lib size | raw lib size | remarks |
| VM | 1750 | data sheet , builtins, security | |
| fawk | 400 | 1600 | data sheet , tutorial |
| fbas | 600 | 1700 | data sheet , tutorial |
| fpas | 500 | 1600 | data sheet , tutorial |
| single source, modular (#include vm then #include language(s)) | |||
| component | sc size | source file | |
| VM | 1750 | libfawk_sc_vm/libfawk_sc_vm.c | |
| fawk | 850 | libfawk_sc_vm/libfawk_sc_fawk.c | |
| fbas | 950 | libfawk_sc_vm/libfawk_sc_fpas.c | |
| fpas | 850 | libfawk_sc_vm/libfawk_sc_fbas.c | |
| single source, combined versions (#include only 1 file) | |||
| component | sc size | source file | |
| VM+fawk | 2500 | libfawk_sc_fawk/libfawk_sc_fawk.c | |
| VM+fbas | 2600 | libfawk_sc_fbas/libfawk_sc_fbas.c | |
| VM+fpas | 2500 | libfawk_sc_fpas/libfawk_sc_fpas.c | |
| VM+fawk+fbas+fpas | 4100 | libfawk_sc_all/libfawk_sc_all.c | |
Legend:
- sizes are in SLOC and represent maximum values, the actual code is usually a few dozen lines smaller
- edit lib size: source code size of the non-compacted library version (generated grammar .c/.h files are not included, the .y file is included)
- raw lib size: to-be-compiled source code size of the non-compacted library version (.y is not included but the generated grammar .c/.h files are included)
- sc size: "single source version", where source files are all merged into a large, compacted single C file that can be #included
Current state
First release, API is considered stable.
Focus
Libfawk tries to be small, portable and usable for developing bigger scripts within a host applications. It does not try to be:
- a complete awk/basic/anything implementation
- efficient in any way (regarding CPU or memory)
- a modern, fancy, OOP/functional language
For more info on why I wanted a new scripting language, please visit the FAQ.
Download and contact
Latest source from VCS: svn://repo.hu/libfawk/trunk
Release tarballs: release page
Author: Tibor 'Igor2' Palinkas
Contact (email and IRC): http://igor2.repo.hu/contact.html