_______ _______ __ _ ______ _ _ _ ____ ____ ____ |______ | |______ | \ | | ____ |\/| | |___ |--< [__] | |_____ |______ | \_| |_____| Version: 2 I. Introduction This software is an implementation of "FLENG", a low level concurrent logic programming language descended from Prolog, intended for 8-bit microcomputers. A compiler is provided to translate programs written in FLENG into assembly language which can subsequently be assembled and linked into a binary executable. As FLENG is quite minimal in features, a translator from "Flat Guarded Horn Clauses" and "Strand" (other, hgher-level concurrent logic languages) into FLENG is also available. The compiler is hosted on UNIX systems and allows cross-compilation of FGHC, Strand and FLENG code to one of the following targets: - CP/M, running on Z80 CPUs - Commodore 64 - The "Uxn" virtual machine[10] The project is an experiment in implementing concurrent logic programming languages on very constrained computers. Performance in terms of execution speed is quite limited, depending on the underlying platform. Work is ongoing to improve the quality of the generated code, but the limitations of the host system should be kept in mind. FLENG programs allow for high parallelism at a very fine grained level - goals are executed concurrently and communicate solely via single-assignment logic variables. The use of logic variables for inter-process communication offers an easy to use and convenient abstraction to implement many common patterns of synchronization and message passing in a natural manner. Automatic management of memory is provided using a reference-counting scheme of fixed size cells, which avoids fragmentation and garbage collection pauses and keeps the overall memory required to hold live data at any point of time minimal. Interfacing to native code is straightforward and compiled FLENG code and the run time library support can access external assembler code. The compiler generates native code, but does currently not perform a lot of optimizations, so performance-sensitive code should probably be written in assembler. FLENG should be particularly well suited as a coordination language for providing intercommunication and synchronization with reasonable overhead while calling out to native code for low-level or speed-critical operations. Suggestions for improvement or patches providing enhancements and corrections are very welcome, see the user's manual for information on how to contact the author. This software was written by Felix L. Winkelmann and has been released into the public domain. See the file "LICENSE" for more information. A git[4] repository containing the sources can be found at the projects gitlab site[5]. See also [8] for a more feature-rich variant of FGHC/Strand/FLENG for UNIX environments. II. Build and Installation * Requirements: The run-time system for FLENG is written in assembly language and uses either "zasm"[6] (for Z80 targets) or "xa"[7] (for 6502 targets) The FGHC-to-FLENG translator and the FLENG compiler are written in mostly ISO compliant Prolog and are known to run under SWI[1], GNU[2] Prolog and YAP[3]. You will need one of these Prolog systems to be installed, make(1) and a POSIX compliant sh(1). If you are interested in ports to other platforms, please contact me. * Configuration: First run the "configure" shell script, optionally providing arguments. Enter ./configure --help to see a list of options for specifying the installation location and possibly selecting the host Prolog implementation to use. By default, the system will be installed in "/usr/local" and use GNU Prolog, if found, or, alternatively SWI Prolog or YAP. You must specify a target, using the "--target" option. * Building: Once configuration has been done, you can run make(1) to build the compiler and run-time system: make If no errors occur, you can optionally enter make check For the C/PM target, this will assume the emulator[11] is installed adn will run all tests. For the C64 target, two disk images with all compiled tests are created. * Installation: To install, enter make install If you have no permissions to access the installation location, use sudo(1) or doas(1) when invoking "make install". The following files will be installed: $PREFIX |-- bin | `-- -fleng |-- share | |-- microfleng | | `-- .inc | | `-- .inc | | `-- *.ghc | |-- doc | | `-- microfleng | | `-- README | | `-- MANUAL | `-- man | `-- man1 | `-- -fleng.1 `-- lib `-- -fleng `-- uxnasm <- if target is uxn `-- fghc2fl <- only if GNU Prolog is used `-- fl2 <- `-- *.swi <- only if SWI Prolog is used `-- *.yap <- only if YAP Prolog is used `-- rt0.bin III. Get into Contact In case you need help, have suggestions or ideas, please don't hesitate to contact the author at felix AT call-with-current-continuation DOT org There is the IRC channel "#fleng" on https://libera.chat/ where you can ask questions, suggest improvements or if you just want to chat. IV. References [1] http://www.swi-prolog.org [2] http://www.gprolog.org [3] https://github.com/vscosta/yap [4] https://git-scm.com/ [5] https://gitlab.com/b2495/fleng/-/tree/microfleng [6] https://github.com/Megatokio/zasm [7] https://www.floodgap.com/retrotech/xa/ [8] https://gitlab.com/b2495/fleng/ [9] https://github.com/jhallen/cpm [10] https://100r.co/site/uxn.html