2
1
Fork
You've already forked fleng
1
A compiler for the concurrent logic programming languages FGHC, Strand, KL1 and PCN.
  • C 38.7%
  • Assembly 24.6%
  • Prolog 14.9%
  • Python 11.9%
  • MATLAB 6.8%
  • Other 3.1%
Find a file
2026年06月01日 19:52:00 +02:00
bench unloaded peer specifier and thread_loads/2 primitive 2024年06月03日 23:09:05 +02:00
boot Fix build on recent macOS. Symbols D0-D31 are wide SIMD register names now, cant use them for labels. 2026年06月01日 13:20:40 +00:00
compiler Fix build on recent macOS. Symbols D0-D31 are wide SIMD register names now, cant use them for labels. 2026年06月01日 13:20:40 +00:00
doc doc fixes 2026年04月01日 23:09:36 +02:00
examples added missing options file to repo and dist 2025年02月21日 22:00:24 +01:00
failing some tests from KLIC that still fail 2025年01月12日 15:10:24 +01:00
include drop forking 2025年01月25日 12:03:27 +01:00
lib doc fixes 2026年04月01日 23:09:36 +02:00
misc bugfixes, PCN enhancements 2024年04月23日 11:56:43 +02:00
patches helpful patches 2021年12月16日 21:56:49 +00:00
src check for all sdl2 libraries at the same time 2025年12月20日 16:44:50 +00:00
tests handle non-char list in regex patterns 2025年01月25日 12:03:57 +01:00
.gitlab-ci.yml add build artefact to CI 2024年09月02日 13:07:34 +02:00
bnch use XFLFLAGS in bnch 2024年12月28日 00:43:27 +01:00
build allow building without PCN/KL1 2025年03月08日 09:27:42 +01:00
cdo.c handle no-cmd case (just return status) 2023年01月20日 16:29:59 +00:00
chk enable leak-checks for single-threaded tests 2025年01月12日 15:09:57 +01:00
configure check for all sdl2 libraries at the same time 2025年12月20日 16:44:50 +00:00
dist missing boot dir 2025年03月17日 23:22:24 +01:00
entrypoints.ghc updated entry points 2025年03月17日 18:35:27 +01:00
fl another helper script 2021年08月01日 13:17:29 +00:00
fleng.m 9p: allow connecting via direct socket, app:translate 2025年12月23日 11:21:31 +01:00
flengbundle.ghc drop failing test, move include files, start with multiline bb edit widget 2025年01月12日 15:08:39 +01:00
flengdoc.ghc flengdoc: properly parse "<mod>:" 2024年12月23日 16:52:37 +01:00
flengdraw.pcn fix use of function 2024年12月24日 14:50:21 +01:00
flengmake.ghc starting KL1 front-end and library 2024年08月29日 19:51:03 +02:00
gprof2dot.py handy 2022年02月18日 22:52:03 +00:00
image.png sdl, ezd improvements and bugfixes, added flengdraw 2024年06月23日 13:34:07 +02:00
MANIFEST missing file in manifest 2025年03月17日 19:47:42 +01:00
MANIFEST.pack drop failing test, move include files, start with multiline bb edit widget 2025年01月12日 15:08:39 +01:00
mkentrypoints rename include file to avoid colliding with source modules 2024年11月04日 14:04:07 +01:00
mkrelease added PCN tutorial, don't drop default include paths for cc, fix warnings, const exprs in PCN array dims 2024年01月20日 15:38:20 +01:00
mkversion obsolete 2025年03月17日 19:48:43 +01:00
rcheck always delete extraction dir 2025年03月17日 23:22:11 +01:00
README updated URL in readme 2026年04月01日 23:13:17 +02:00
run1 helper tool for compile/run with stage1 compiler 2023年02月07日 21:24:11 +00:00
shell.nix for development 2023年09月02日 10:28:56 +00:00
spin allow count in spin tool 2025年01月06日 20:56:10 +01:00
unifont.png updated configuration, build, added some missing files 2023年09月01日 21:01:06 +00:00

 _______ _______ __ _ ______
 |______ | |______ | \ | | ____
 | |_____ |______ | \_| |_____|
 Version: 24
I. Introduction
This software is an implementation of "FLENG", a low level concurrent
logic programming language descended from Prolog. A compiler is
provided to translate programs written in FLENG into assembly language
which can subsequently be compiled and linked into a binary
executable. As FLENG is quite minimal in features, translators from
"Flat Guarded Horn Clauses (FGHC)", "Strand", "KL1" and "PCN" (other,
higher- level concurrent logic languages) into FLENG are also
available.
FLENG programs allow for massive 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. This implementation
additionally can distribute pools of parallel processes over native
OS level threads, thus taking advantage of multicore architectures.
Locking overhead should be small, as data is normally not shared
among processes executing on different threads. Automatic management
of memory is provided using a reference-counting scheme of fixed
size cells, which avoid fragmentation, avoids garbage collection
pauses and keeps the overall memory required to hold live data at
any point of time minimal, while providing relatively good locality.
Interfacing to native code is straightforward and compiled FLENG
code and the run time library support can be linked with other
modules written in C or C++ without problems. The compilation tools
allow cross compilation, provided the architecture is supported.
The compiler generates native code, but does currently not perform
a lot of optimizations, so performance-sensitive code should probably
be written in C or another language. FLENG is particularly well
suited as a coordination language for providing intercommunication
and synchronization with reasonable overhead while calling out to
C or C++ 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 "doc/LICENSE" for more information.
A git[4] repository containing the sources can be found at the projects
codeberg site[5].
II. Build and Installation
* Requirements:
The run-time system for FLENG is written in C99 with GNU extensions
and should be compilable with most C compilers. The FGHC-to-FLENG
and PCN-to-FLENG translators and the FLENG compiler are written in
FGHC and require either a set of precompiled assembler files (included
in the distribution tarball), a previously built FLENG system or a
Prolog implementation that can be used to bootstrap the system.
Currently, SWI[1] Prolog , GNU[2] Prolog and YAP[3] are supported.
You additionally need a POSIX compliant sh(1) and optionally make(1)
(GNU or BSD).
The system is known to run on Linux and BSD-based UNIX systems.
Supported target architectures are x86-64 armv6 (hardfp), AArch64,
Apple M1 and riscv64 (R64IMAFD). If you are interested
in ports to other platforms, please contact me.
Support for graphical applications is provided by libraries interfacing
to SDL2[6]. If available on the installation system, these libraries
will be built and added to the module library. A higher level
structured graphics toolkit with a design based on Joel Bartletts
"EZDraw" system[7] provides more convenient means for programming
graphical applications and is built on top of the SDL interface.
At least SDL2 and SDL2_image are needed for graphics programming,
SDL2_ttf and SDL2_mixer are optional. If these can't be found
during the configuration phase of the build, then the system falls
back on a built-in 16x8 bitmap font and font and sound-related
operations silently fail.
* 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.
"configure" adds the contents of the environment variables "CC",
"CFLAGS" and "LDFLAGS" to the default compiler and linker
invocations, if set.
If the libraries for graphics support are not required, pass the
"--disable-sdl" option to the invocation of "configure".
* Building:
Once configuration has been done, you can run make(1) to build the
compiler and run-time system.
First, run
 make
(If you build directly from the sources of the development
repository[5], you should first run
 make spotless
to ensure no old translated files from previous check outs pollute
the build.)
If no errors occur, you can optionally enter
 make check
to run the test suite.
 make bench
Runs a number of test programs and measures their run time.
When building from a distribution tarball, the system is usually
directly generated from precompiled assembler files. By removing
or renaming the "asm" directory you can force building the system
completely from sources with one of the supported Prolog systems
by entering
 make bootstrap
you will force a bootstrap from the baseline Prolog compiler.
A suitable Prolog system will be searched, you can override the
automatic search by using the "--with-prolog" option for the
"configure" script, giving it the full path to the Prolog compiler
intended to use for bootstrapping.
Building the system in a different directory than the one containing
the source code is not supported.
By setting the environment variable "FLENG_PREFIX" to the current
working directory, you can use the generated "fleng" driver script
in-place to use or test the system without installation.
* Installation:
To install, enter
 make install
If you do not have permissions to access the installation location,
use sudo(1) or doas(1) when invoking "make install". The variable
"$DESTDIR" will be respected when defined to further customize the
installation destination.
The following files will be installed:
 $PREFIX Defaults to /usr/local
 |-- bin
 | |-- fghc2fl FHGC->FLENG compiler
 | |-- pcn2fl PCN->FLENG compiler
 | |-- kl12fl						KL1->FLENG compiler
 | |-- fl2<ARCH> FLENG->assembler compiler
 | |-- flengdoc Documentation tool
 | |-- flengmake Build tool
 | |-- flengbundle Tool for integration data
 | |-- flengdraw Graphics editor
 | `-- fleng Driver script
 |-- include
 | `-- fleng
 | |-- fleng-util.h Utility header for C extensions
 | |-- fleng.h Main header for C extensions
 | `-- pcn.h Default include file for PCN code
 |-- share
 | |-- doc
 | | `-- fleng
 | | |-- MANUAL User's manual
 | | |-- INTERNALS Documentation on some internals
 | | |-- LIBRARY Documentation for all libraries
 | | |-- README This document
 | | |-- LICENSE License
 | | |-- PCN-tutorial.txt PCN tutorial
 | | `-- DOCDB "flengdoc" database
 | | `-- ...
 | `-- man
 | |-- man1
 | | |-- fleng.1 Manual page for driver script
 | | |-- flengdoc.1 Manual page for documentation tool
 | | |-- flengmake.1 Manual page for build tool
 | | |-- flengbundle.1 Manual page for data tool
 | | `-- flengdraw.1 Manual page for graphics editor
 | `-- man7
 | |-- fleng.7 Manual page for runtime options
 | `-- flengdoc.7 Manual page describing documentation format
 `-- lib
 `-- libfleng.a FLENG runtime library
III. Documentation
The documentation is available in textual form in the files
"doc/MANUAL", "LIBRARY" and "doc/INTERNALS". The "flengdoc" tool can
be used to query the documentation reference database, which is
created and installed along with the rest of the system. See
 man flengdoc
for more information.
IV. 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.
V. 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://codeberg.com/Bunny351/fleng
[6] https://www.libsdl.org
[7] https://archive.org/download/bitsavers_dectechrep_144635/WRL-91-6.pdf