4tH is a Forth compiler with a little difference. Instead of the standard Forth engine it features a conventional compiler. 4tH is a very small compiler that can create bytecode, C-embeddable bytecode, standalone executables, but also works fine as a scripting language. It supports about 95% of the ANS Forth CORE wordset and features conditional compilation, pipes, files, assertions, forward declarations, enumerations, structures, suspended execution, recursion, include files, etc. It comes with an RPN calculator, line editor, preprocessor, compiler, decompiler, C-source generator, a virtual machine, and a multitasking environment.
| Tags | Software Development Libraries Code Generators Compilers |
|---|---|
| Licenses | LGPLv3+ |
| Operating Systems | Windows MS-DOS POSIX Linux Windows Windows Windows Mac OS X BSD |
| Implementation | Forth C |
Recent releases


Release Notes: Unions and pragmas can be defined. The library files now support several polynomials, RAM disks, menus, bitfields, bit arrays, several new sorting algorithms, Morse signs, and 3VL. The preprocessor was enhanced, supporting S\", token concatenation, string comparison, variable assignment, and smart double number/FP literals. 'DOES>' can be used to change the execution semantics of basic data types. A bug in the Linux Makefile was fixed. Overflow and underflow errors in number conversion were fixed. A bug in the 'IF' statement of 4tsh was fixed. The accuracy of the 'FERF' words was improved.


Release Notes: Specific code can be executed after a failed 'WHILE' just before exiting the loop. Binary strings can be tagged individually. The library files now support UTF-8 to GBK/2 conversion (and vice versa), infix formula translation, string pattern matching, finite state machines, statistical functions, enhanced command line parsing and the full range of ANS Forth floating point words for ZEN float. The preprocessor now supports string parsing with custom delimiters, macros within macros, and a string stack. A Markov engine and an infix-to-postfix converter were added to the examples.


Release Notes: A peephole optimizer was added. The library files now support a tiny database management system, double number multiplication, double number division, LaTeX file generation, and the XCHAR wordset. SEEK can now be used to reposition the file to the end. The words 2NIP and [FORCE] were added. Several obscure bugs were fixed. Support for 64-bit architectures was greatly improved. On Linux, compilation is now staged. A nuclear test simulation was added to the preprocessor examples.


Release Notes: The words ’DELETE-FILE’ and ’ENVIRON@’ have been added. The library files now support writing OpenOffice, KOffice, and Microsoft XML spreadsheets, different sorting algorithms, the creation of floating point interpreters, GTK-server, Forth compatible floating point I/O for ZEN float, portable bitmap graphics and Turtle graphics. Files can now be deleted and environment variables can be queried. The maximum symbol length is increased to 23 characters. Two tiny spreadsheet programs were added to the examples.


Release Notes: The performance of several bytecodes was improved. 'AKA' was enhanced. 'FIELD:' was added. The preprocessor now supports blockfiles, parameters, ANS Forth structures, and 'SYNONYM'. The memory allocation and 'PARSE-NAME' libraries were rewritten. Several new libraries were added, including Soundex support and ARC4 and TEAN encryption. A TinyC interpreter was added to the examples.