Projects / 4tH compiler

4tH compiler

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.

Operating Systems

Recent releases

  •  23 Feb 2014 15:05

    Release Notes: Support for quotations was added. The library files now support coroutines, HTML generation, Adler32, MD5, and SHA-1/256 checksum routines, and several new randomizers. ANS Forth conversion and library specific support in the preprocessor were moved to preprocessor libraries; most don't use any registers. The object orientation method definition and closures syntax has been cleaned up. The preprocessor has been vastly enhanced, supports symbol definition and verbose options, and you can execute, save, or generate C source without calling 4th separately. A tiny Web server was added to the examples.

    •  25 Sep 2013 15:25

      Release Notes: The words ':TOKEN' and 'EQUATES' have been added. The library files now support virtual memory, simple garbage collection, RfC 4180-compliant parsing, SEDOL numbers, Chi square calculations, runtime macros, and several new sorting routines. Several new date and time parsing functions were added. Several beta- and gamma-related functions were added to the floating point library. The preprocessor now supports division and modulo with the new @divrm function. Lots of bugfixes were made.

      •  23 Dec 2012 13:07

        Release Notes: The library files now support logfiles, automated date parsing, LZ77 file compression and CSV file creation. The last defined word can be compiled anonymously. Object orientation now supports regular methods. The Sourceforge "Block reserved extension words" were added. New peephole optimizers were added to the compiler, allowing automatic compile time calculations. exec_4th() can be optimized for GCC by using the compiler switch -DUSEGCCGOTO. The word 'SMOVE' was added.

        •  08 Aug 2012 16:05

          Release Notes: The library files now support FCEIL, KEY, KEY?, SUBSTITUTE, REPLACES, UNESCAPE, counted strings, 'Q' function, Catalan numbers, Riemann zeta, spell distance, new graphics functions and frexp(), and ldexp() like words. A new implementation of the ANS MEMORY wordset was added. New preprocessor words were added like FFIELD:, @eval, @mul, @minus and @sign. Stack usage of the preprocessor was significantly reduced. New preprocessor libraries add support for object orientated programming. The speed and accuracy of the FSIN, FCOS, FTAN, FEXP, FLN, and FLOG words was improved. Several minor bugfixes.

          •  30 Mar 2012 13:45

            Release Notes: The library files now support stem-leaf plots, finite difference, compass boxing, HTML and XML character entities, Hamming (7,4) codes, Base64 conversion, FEXPM1, and FLNP1. Preprocessor macros can be undefined with the 'SCRAP:' keyword, and simple flow control was added. PAD size is increased to 768 characters to make pictured numeric output 64-bit compliant. The accuracy of FSINH, FCOSH, FTANH, FASIN, FACOS, and FATAN was significantly improved. The words '[ELSE]' and '[IGNORE]' have been added. Coherent 4.2.x and Android 3.x ports are now available.


            Project Spotlight


            A Fluent OpenStack client API for Java.


            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.