GNU Prolog is a native Prolog compiler

Related tags

Compilers gprolog
Overview
                                GNU PROLOG
                                ==========

			      by Daniel Diaz
			   [email protected]


INTRODUCTION
************

GNU Prolog is a native Prolog compiler with constraint solving over finite
domains (FD) developed by Daniel Diaz (http://cri-dist.univ-paris1.fr/diaz/)
Last information can be found at http://www.gnu.org/software/prolog
or better at http://www.gprolog.org.

A lot of work has been devoted to the ISO compatibility. GNU Prolog is very
close to the ISO standard.

Here are some features of GNU Prolog:

Prolog system:

   - conforms to the ISO standard for Prolog (integer/floating arithmetic,
     streams, dynamic code, exceptions).
   - clause indexing.
   - a lot of extensions: global variables, definite clause grammars (DCG),
     sockets interface, operating system interface,...
   - more than 300 Prolog built-in predicates.
   - Prolog debugger and a low-level WAM debugger.
   - line editing facility under the interactive interpreter with completion
     on atoms.
   - powerful bidirectional interface between Prolog and C.

Compiler:

   - native-code compiler producing stand alone executables.
   - simple command-line compiler accepting a wide variety of files:
     Prolog files, C files, WAM files,...
   - direct generation of assembly code 15 times faster than wamcc + gcc.
   - most of unused built-in predicates are not linked (to reduce the size
     of the executables).
   - compiled predicates (native-code) as fast as wamcc on average.
   - consulted predicates (byte-code) 5 times faster than wamcc.

Constraint solver:

   - FD variables well integrated into the Prolog environment (full
     compatibility with Prolog variables and
   - integers). No need for explicit FD declarations.
   - very efficient FD solver (comparable to commercial solvers).
   - high-level constraints can be described in terms of simple primitives.
   - a lot of predefined constraints: arithmetic constraints, boolean
     constraints, symbolic constraints, reified constraints,...
   - several predefined enumeration heuristics.
   - the user can define his own new constraints.
   - more than 50 FD built-in constraints/predicates.



PORTS
*****

GNU Prolog is currently ported to the following architectures:

   - ix86 / GNU/Linux
   - ix86 / Win32 using Cygwin (see file src/WINDOWS)
   - ix86 / Win32 using MinGW  (see file src/WINDOWS)
   - ix86 / Win32 using MSVC++ (see file src/WINDOWS)
   - ix86 / SCO
   - ix86 / Solaris
   - ix86 / FreeBSD
   - ix86 / OpenBSD
   - ix86 / NetBSD
   - ix86 / Darwin (Mac OS X)
   - x86_64 / GNU/Linux
   - x86_64 / Solaris
   - x86_64 / Win64 using MinGW64 (see file src/WINDOWS64)
   - x86_64 / Win64 using MSVC++  (see file src/WINDOWS64)
   - x86_64 / Darwin (Mac OS X)
   - PowerPC / GNU/Linux
   - PowerPC / Darwin (Mac OS X)
   - PowerPC / NetBSD
   - sparc / SunOS (4.1.3 or higher)
   - sparc / Solaris
   - sparc / NetBSD
   - sparc64 / OpenBSD
   - alpha / GNU/Linux
   - alpha / OSF1
   - mips / irix
   - arm 32bits (armv7) / GNU/Linux
   - arm 64bits (aarch64) / GNU/Linux



INSTALLATION
************

Please refer to the INSTALL file (in the same directory)



USING GNU PROLOG
****************

Be sure that adequate environment variables are set (see INSTALL)

You can then invoke the top-level using:

	gprolog

and the compiler using:

	gplc FILE

The simplest way to compile a Prolog file 'prog.pl' is then:

	gplc prog.pl

which will produce the executable called prog (use gplc --help to have a
brief overview of available options).

Refer to the documentation for more information (see below).



WINDOWS
*******

In Microsoft Windows if you intend to use the gplc compiler as described in
the documentation you need to ascertain the following conditions are
met:

   - for the port compiled with MS Visual C++ (tested with version
     6.0 and Visual C++ 2005 Express Edition) you'll need to have
     MinGW as.exe (renamed as mingw-as.exe) installed and the cl.exe
     compiler (used mainly as linker by GNU Prolog) available in 
     your session path (alternatively link.exe is used).

   - for the ports compiled either with MinGW or Cygwin, the gcc
     toolchain must be installed and available in your session
     path.

Observing these needs you'll also will be able to do the mixed
language programming, as the examples included in the ExamplesC
directory. However you'll need to write your own Makefile as the one
provided is for gplc calling 'gcc' and the options passed by GNU
Prolog will not work (see file ExamplesC/README).



DOCUMENTATION
*************

The directory doc contains various versions of the manual. Refer to the
file doc/README for more information.

An in-line HTML version can be accessed from the GNU Prolog web page.



WEB
***

The GNU Prolog web site is: http://www.gnu.org/software/prolog/
or also (primary web site): http://www.gprolog.org/



MAILING LIST
************

To communicate with other GNU Prolog users and/or implementors send a mail to
[email protected]. To (un)subscribe to this mailing list send a mail to
[email protected] with (un)subscribe in the subject line.



BUGS
****

Please report bugs to [email protected]. To (un)subscribe to this mailing
list send a mail to [email protected] with (un)subscribe in the
subject line.



COPYING
*******

GNU Prolog is free software. Since version 1.4.0, GNU Prolog distributed
under a dual license: LGPL or GPL. So, you can redistribute it and/or modify
it under the terms of either:

  * the GNU Lesser General Public License (LGPL) as published by the Free
    Software Foundation; either version 3 of the License, or (at your option)
    any later version.

or 

  * the GNU General Public License (GPL) as published by the Free Software
    Foundation; either version 2 of the License, or (at your option) any
    later version.  

or both in parallel (as here).

GNU Prolog is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received copies of the GNU General Public License and the GNU
Lesser General Public License along with this program. If not, see
http://www.gnu.org/licenses/.

Remark: versions of GNU Prolog prior to 1.4.0 were entirely released under
the GNU General Public License (GPL).


LocalWords:  wamcc sparc irix gplc prog.pl mingw-as.exe
Comments
  • directory_files/2 predicate broken on Windows?

    directory_files/2 predicate broken on Windows?

    I'm testing GNU Prolog 1.5.0 (x86_64 / Windows 10 with MSVC++) on Windows 10. No matter the path I pass as first argument, I always get a error(system_error('No such file or directory'), directory_files/2) or error(system_error('No error'),directory_files/2) exceptions.

    opened by pmoura 10
  • length(L,L) unexpected failure

    length(L,L) unexpected failure

    ulrich@p0:/opt/gupu/gprolog$ git describe
    v1.5.0-16-ge6354f6
    ulrich@p0:/opt/gupu/gprolog$ ./src/TopComp/gprolog 
    GNU Prolog 1.5.1 (64 bits)
    Compiled Feb 24 2022, 09:43:50 with gcc -std=gnu99
    Copyright (C) 1999-2022 Daniel Diaz
    
    | ?- length(L,L).
    
    no % unexpected
    | ?- length([a,b|L],L).
    
    no % unexpected
    

    See this justification.

    opened by UWN 9
  • Unexpected type error in length/2

    Unexpected type error in length/2

    This was #95.

    | ?- X #>= 0, length(_,X).
    uncaught exception: error(type_error(integer,_#2097954(0..268435455)),(#>=)/2)
    | ?- length(_,X), X #>= 0, length(_,X). 
    
    X = 0 ? ;
    
    X = 1 ? ;
    
    X = 2 ? ;
    
    X = 3 ? ;
    
    X = 4 ? 
    

    All instances permitted by _#2097954(0..268435455) are valid integers. Therefore, a type error integer does not fit.

    opened by UWN 7
  • DOC Build Errors (convert & latex)

    DOC Build Errors (convert & latex)

    The default build includes a doc-required command convert - please advise; thanks in advance.

    (cd ../doc; make all)
    make[1]: Entering directory '/home/jacob/projects/gprolog/doc'
    convert -scale 150x150 ../gprolog.ico[5] logo.eps
    /bin/sh: 1: convert: not found
    make[1]: *** [Makefile:75: logo.eps] Error 127
    make[1]: Leaving directory '/home/jacob/projects/gprolog/doc'
    make: *** [Makefile:54: doc] Error 2
    
    opened by jacobfriedman 6
  • length/2 regression

    length/2 regression

    length(List, Length) now sometimes produces a type_error(list,_) when there is no instance of List that is a list. In the past, length/2 uniformly failed in this case, as specified by the template and mode length(?term, ?integer).

    See #4 ff:

    | ?- length(2,0). 
    uncaught exception: error(type_error(list,2),top_level/0) % regression
    | ?- length([_|2],0). 
    
    no                                                        % expected
    | ?- length([_|2],N). 
    uncaught exception: error(type_error(list,2),top_level/0) % regression
    | ?- length([_|2],1). 
    uncaught exception: error(type_error(list,2),top_level/0) % regression
    | ?- length([_,_|2],1). 
    
    no                                                         % expected
    
    opened by UWN 4
  • Using gplc on Windows 10

    Using gplc on Windows 10

    I'm trying to use gplc on Windows 10. GNU Prolog was installed using the latest setup-gprolog-1.5.1-msvc-x64.exe beta installer. The gplc command is being called from a new Logtalk PowerShell embedding script. The same embedding examples that work e.g. in macOS, on Windows 10 end with a compilation failed message with no hint of what went wrong. Is there a dependency that I may be missing on Windows 10 that's required for successfully using gplc? Any suggestions on how to diagnose this issue?

    opened by pmoura 3
  • append/3 incorrect

    append/3 incorrect

    ulrich@p0:/opt/gupu/gprolog$ git describe
    v1.5.0-19-gb0a17f5
    ulrich@p0:/opt/gupu/gprolog$ src/TopComp/gprolog 
    GNU Prolog 1.5.1 (64 bits)
    Compiled Feb 24 2022, 09:43:50 with gcc -std=gnu99
    Copyright (C) 1999-2022 Daniel Diaz
    
    | ?- L=[a|n],append([a|L],n,L).
    
    no % expected
    | ?-         append([a|L],n,L).        
    
    L = [a|n] ? % unexpected
    
    (3 ms) yes
    
    opened by UWN 3
  • Comment issue

    Comment issue

    $ ./src/TopComp/gprolog GNU Prolog 1.5.0 (64 bits) Compiled Sep 16 2021, 17:45:37 with gcc Copyright (C) 1999-2021 Daniel Diaz

    | ?- length(L,2).

    L = [_,_]

    yes | ?- length(L,2). % comment

    L = [_,_]

    yes | ?- length(L,N). % comment

    L = [] N = 0 ? Action (; for next solution, a for all solutions, RET to stop) ?;

    L = [_] N = 1 ? Action (; for next solution, a for all solutions, RET to stop) ? Action (; for next solution, a for all solutions, RET to stop) ? Action (; for next solution, a for all solutions, RET to stop) ? Action (; for next solution, a for all solutions, RET to stop) ? Action (; for next solution, a for all solutions, RET to stop) ? Action (; for next solution, a for all solutions, RET to stop) ? Action (; for next solution, a for all solutions, RET to stop) ?

    yes | ?-

    opened by flexoron 3
  • Attempting to build on Termux

    Attempting to build on Termux

    I saw you added ARM support and thought it would be cool if gprolog could run on the Termux platform (maybe this is a low-hanging fruit). So I attempted to build it to see what falls out.

    Errors: (copied from below)

    engine1.c:137:9: error: invalid symbol kind for ADRP relocation asm("adrp x20, _pl_reg_bank@GOTPAGE"); ^ :1:2: note: instantiated into assembly here adrp x20, _pl_reg_bank@GOTPAGE ^ engine1.c:138:9: error: invalid fixup for 64-bit load/store instruction asm("ldr x20, [x20, _pl_reg_bank@GOTPAGEOFF]"); ^ :1:2: note: instantiated into assembly here ldr x20, [x20, _pl_reg_bank@GOTPAGEOFF] ^

    I am building on an android 11 device using termux version 0.112

    $ ./configure

    checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for gcc option to accept ISO C99... none needed checking for gcc option to accept ISO Standard C... (cached) none needed checking build system type... aarch64-unknown-linux-gnu checking host system type... aarch64-unknown-linux-gnu checking for as... as checking for ranlib... ranlib checking for windres... no checking for ar... ar checking for strip... strip checking whether make sets $(MAKE)... yes checking for a BSD-compatible install... /data/data/com.termux/files/usr/bin/install -c checking whether ln -s works... yes checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /data/data/com.termux/files/usr/bin/grep checking for egrep... /data/data/com.termux/files/usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking whether byte ordering is bigendian... no checking for inline... inline checking size of int... 4 checking size of long... 8 checking size of void*... 8 checking sys/ioctl_compat.h usability... no checking sys/ioctl_compat.h presence... no checking for sys/ioctl_compat.h... no checking sys/siginfo.h usability... no checking sys/siginfo.h presence... no checking for sys/siginfo.h... no checking termios.h usability... yes checking termios.h presence... yes checking for termios.h... yes checking malloc.h usability... yes checking malloc.h presence... yes checking for malloc.h... yes checking endian.h usability... yes checking endian.h presence... yes checking for endian.h... yes checking sys/endian.h usability... yes checking sys/endian.h presence... yes checking for sys/endian.h... yes checking byteswap.h usability... yes checking byteswap.h presence... yes checking for byteswap.h... yes checking float.h usability... yes checking float.h presence... yes checking for float.h... yes checking for stdlib.h... (cached) yes checking for unistd.h... (cached) yes checking for sys/param.h... yes checking for getpagesize... yes checking for working mmap... yes checking for getpagesize... (cached) yes checking for mprotect... yes checking for sigaction... yes checking for mallopt... yes checking for fgetc... yes checking whether htole32 is declared... yes checking whether bswap_32 is declared... yes checking for fpclass... no checking for _fpclass... no checking for isnan... yes checking for isinf... yes checking for atanh... yes checking for acosh... yes checking for asinh... yes checking for socklen_t... yes checking if struct sigcontext needs asm/sigcontext.h... no checking for sigsetjmp... yes checking for a working sigaction... yes checking constructors execution order... first to last checking for socket... yes checking for gethostbyname... yes DIRECTORIES --> Installation: /usr/local/gprolog-1.5.0 --> Link to binaries: /usr/local/bin --> Documentation: /usr/local/gprolog-1.5.0/doc --> HTML documentation: /usr/local/gprolog-1.5.0/doc/html_node --> Examples: /usr/local/gprolog-1.5.0/examples ./configure: 6698: cannot create /tmp/version_no.tex: Directory nonexistent mv: cannot stat '/tmp/version_no.tex': No such file or directory ./configure: 6705: cannot create /tmp/copyright.tex: Directory nonexistent mv: cannot stat '/tmp/copyright.tex': No such file or directory configure: creating ./config.status config.status: creating Makefile config.status: creating TopComp/Makefile config.status: creating Pl2Wam/Makefile config.status: creating Wam2Ma/Makefile config.status: creating Ma2Asm/Makefile config.status: creating Fd2C/Makefile config.status: creating Linedit/Makefile config.status: creating W32GUICons/Makefile config.status: creating EnginePl/Makefile config.status: creating BipsPl/Makefile config.status: creating EngineFD/Makefile config.status: creating BipsFD/Makefile config.status: creating Ma2Asm/FromC/Makefile config.status: creating Win32/Makefile config.status: creating Win32/gp-vars-iss.txt config.status: creating EnginePl/gp_config.h config.status: EnginePl/gp_config.h is unchanged

    $ make

    cd EnginePl; make config make[1]: Entering directory '/data/data/com.termux/files/home/Projects/gnuprolog/gprolog/src/EnginePl' gcc -fno-strict-aliasing -fcommon -O3 -fomit-frame-pointer -Wno-char-subscripts -o pl_config pl_config.c ./pl_config

    -------------------------------
    --- GNU PROLOG INSTALLATION ---
    -------------------------------
    

    GNU Prolog version: 1.5.0 (Jun 5 2021) Operating system : linux-gnu Processor : aarch64 Size of a WAM word: 64 bits C compiler : gcc C flags : -O3 -fomit-frame-pointer -Wno-char-subscripts C flags machine : -fno-strict-aliasing -fcommon Assembler : as Assembler flags : Loader flags : Loader libraries : -lm Use line editor : Yes Use piped consult : Yes Use sockets : Yes Use FD solver : Yes Use machine regs. : Yes (0 used) Used register(s) : none

    ------------------------------
    

    (cd ../TopComp; make gplc) make[2]: Entering directory '/data/data/com.termux/files/home/Projects/gnuprolog/gprolog/src/TopComp' gcc -fno-strict-aliasing -fcommon -O3 -fomit-frame-pointer -Wno-char-subscripts -o gplc top_comp.c -lm make[2]: Leaving directory '/data/data/com.termux/files/home/Projects/gnuprolog/gprolog/src/TopComp' make[1]: Leaving directory '/data/data/com.termux/files/home/Projects/gnuprolog/gprolog/src/EnginePl' . ./SETVARS;for i in EnginePl TopComp Wam2Ma Ma2Asm Linedit BipsPl Pl2Wam Fd2C EngineFD BipsFD;do (cd $i; make) || exit 1; done;
    (cd TopComp; make top-level) || exit 1;
    (cd Pl2Wam; make stage2) make[1]: Entering directory '/data/data/com.termux/files/home/Projects/gnuprolog/gprolog/src/EnginePl' gcc -fno-strict-aliasing -fcommon -O3 -fomit-frame-pointer -Wno-char-subscripts -o cpp_headers cpp_headers.c gplc -c -C '-O3 -fomit-frame-pointer -Wno-char-subscripts' machine.c gplc -c -C '-O3 -fomit-frame-pointer -Wno-char-subscripts' machine1.c gplc -c -C '-O3 -fomit-frame-pointer -Wno-char-subscripts' stacks_sigsegv.c gplc -c -C '-O3 -fomit-frame-pointer -Wno-char-subscripts' mem_alloc.c gplc -c -C '-O3 -fomit-frame-pointer -Wno-char-subscripts' misc.c gplc -c -C '-O3 -fomit-frame-pointer -Wno-char-subscripts' hash_fct.c gplc -c -C '-O3 -fomit-frame-pointer -Wno-char-subscripts' hash.c gplc -c -C '-O3 -fomit-frame-pointer -Wno-char-subscripts' obj_chain.c gplc -c -C '-O3 -fomit-frame-pointer -Wno-char-subscripts' engine.c gplc -c -o engine1.o engine1.c engine1.c:137:9: error: invalid symbol kind for ADRP relocation asm("adrp x20, _pl_reg_bank@GOTPAGE"); ^ :1:2: note: instantiated into assembly here adrp x20, _pl_reg_bank@GOTPAGE ^ engine1.c:138:9: error: invalid fixup for 64-bit load/store instruction asm("ldr x20, [x20, _pl_reg_bank@GOTPAGEOFF]"); ^ :1:2: note: instantiated into assembly here ldr x20, [x20, _pl_reg_bank@GOTPAGEOFF] ^ 2 errors generated. compilation failed make[1]: *** [Makefile:83: engine1.o] Error 1 make[1]: Leaving directory '/data/data/com.termux/files/home/Projects/gnuprolog/gprolog/src/EnginePl' make: *** [Makefile:45: all] Error 1

    opened by MikeAmy 3
  • Condition to be at end of stream

    Condition to be at end of stream

    I tried this:

    $ gprolog
    GNU Prolog 1.5.0 (64 bits)
    Compiled Apr 23 2022, 09:20:55 with gcc
    Copyright (C) 1999-2022 Daniel Diaz
    
    | ?- open('/tmp/empty.txt', write, S), close(S).
    
    S = '$stream'(3)
    
    (1 ms) yes
    | ?- open('/tmp/empty.txt', read, _, [alias(empty), reposition(false), eof_action(reset), type(text)]).
    
    yes
    | ?- stream_property(S, alias(empty)), stream_property(S, end_of_stream(E)).
    
    E = not
    S = '$stream'(3)
    
    yes
    | ?- peek_char(empty, C).                                                       
    C = end_of_file
    
    yes
    | ?- stream_property(S, alias(empty)), stream_property(S, end_of_stream(E)).
    
    E = not
    S = '$stream'(3)
    
    yes
    | ?- get_char(empty, C).
    
    C = end_of_file
    
    yes
    | ?- stream_property(S, alias(empty)), stream_property(S, end_of_stream(E)).
    
    E = not
    S = '$stream'(3)
    
    yes
    | ?-
    

    The same happens on a non-empty file.

    opened by notoria 2
  • Aproximate expr evaluation  predicate is/2 result to specific number of decimal places

    Aproximate expr evaluation predicate is/2 result to specific number of decimal places

    System info:

    • System: macOs 12.0.1 intel
    • Gprolog Version: 1.5.0 (64 bit)

    Reproduction:

    ?- A is 0.77 / 10.
    
    A = 0.076999999999999999
    
    yes
    
    ?- A is 0.78 / 10.
    
    A = 0.078
    
    (1 ms) yes
    
    ?- A is 0.79 / 10.
    
    A = 0.079000000000000001
    
    yes
    

    Question:

    Is there a way to select the desired number of decimal places in the resulting expr ?

    opened by R0mb0 2
  • git describe out of sync

    git describe out of sync

    ulrich@p0:/opt/gupu/gprolog/src$ git describe
    v1.5.0-31-gdd3f5ab
    ulrich@p0:/opt/gupu/gprolog/src$ TopComp/gprolog 
    GNU Prolog 1.5.1 (64 bits)
    Compiled Nov 29 2022, 12:37:19 with gcc -std=gnu99
    Copyright (C) 1999-2022 Daniel Diaz
    

    So is this version 1.5.0 or 1.5.1?

    opened by UWN 2
  • Possible to connect standard streams to a process stream?

    Possible to connect standard streams to a process stream?

    I'm adding experimental support to the Logtalk help tool to browse and search inline at the top-level interpreter the Texinfo versions of the Handbook and APIs documentation. This functionality requires connecting the Prolog standard streams to the created info process streams. is this possible with GNU Prolog? I tried the existing exec/4-5 built-in predicates without success. You can see in the link above how I'm doing it for other Prolog systems. It would be nice to have this functionality also working with GNU Prolog.

    opened by pmoura 0
  • bagof/3 Segmentation fault

    bagof/3 Segmentation fault

    $ gprolog
    GNU Prolog 1.5.1 (64 bits)
    Compiled May  7 2022, 16:09:46 with gcc
    Copyright (C) 1999-2022 Daniel Diaz
    
    | ?- bagof(X,X^!=X,Y).
    Segmentation fault (core dumped)
    
    opened by flexoron 4
  • succ/2: missing overflow

    succ/2: missing overflow

    | ?- current_prolog_flag(max_integer, Max), ( integer(Max) -> succ(Max, S) ; true ).
    
    Max = 1152921504606846975
    S = -1152921504606846976, unexpected.
    

    Expected:

    ?- current_prolog_flag(max_integer, Max),
       ( integer(Max) -> succ(Max, S) ; true ).
       evaluation_error(int_overflow)
    |  Max = unbounded.
    
    opened by UWN 2
  • predicate_property/2 doesn't return meta-predicate templates for user defined meta-predicates

    predicate_property/2 doesn't return meta-predicate templates for user defined meta-predicates

    If a user defines e.g. the following meta-predicate:

    :- meta_predicate(mp1(0)).
    mp1(Goal) :-
    	call(Goal).
    

    The predicate_property/2 predicate doesn't return the meta-predicate template:

    | ?- predicate_property(mp1(_), P).
    
    P = static ? ;
    
    P = private ? ;
    
    P = monofile ? ;
    
    P = user ? ;
    
    P = prolog_file(...) ? ;
    
    P = prolog_line(2) ? ;
    
    (1 ms) no
    
    opened by pmoura 0
  • Indefinite recursion in compiled multifile predicates when examined under debugger

    Indefinite recursion in compiled multifile predicates when examined under debugger

    Compiled multifile predicates are called indefinitely (at least under some conditions) when examined under the debugger. I assume this has something to do with how the debugger handles auxillary clauses of multifile predicates, but the code involved isn't completely clear to me. This affects HEAD (as shown) as well as the OpenBSD packaged version I have installed (1.4.5).

    The error does not occur when the shown bugtest.pl file is consulted/loaded.

    sotto-voce$ uname -a
    OpenBSD sotto-voce 7.0 GENERIC.MP#227 amd64
    sotto-voce$ (cd ~/fsrc/gprolog && git describe)
    v1.5.0-1-g8a8220dc
    sotto-voce$ cat bugtest.pl
    :- multifile(p/0).
    
    p.
    sotto-voce$ ~/fsrc/gprolog/src/TopComp/gplc bugtest.pl
    sotto-voce$ ./bugtest
    GNU Prolog 1.5.0 (64 bits)
    Compiled Sep 24 2021, 10:34:40 with cc
    Copyright (C) 1999-2021 Daniel Diaz
    
    | ?- debug, p.
    The debugger will first leap -- showing spypoints (debug)
    
    Fatal Error: local stack overflow (size: 16384 Kb, reached: 16384 Kb, environment variable used: LOCALSZ)
    

    Under trace:

    | ?- trace, p.
    The debugger will first creep -- showing everything (trace)
          1    1  Call: p ?
    
          2    2  Call: p ?
    
          3    3  Call: p ?
    
          4    4  Call: p ? g
    Ancestors:
          1    1  p
          2    2  p
          3    3  p
          4    4  Call: p ? A
    Alternatives:
          1    1  p
          2    2  p
          3    3  p
          4    4  p
    --------------
          4    4  Call: p ? W
    Welcome to the WAM debugger - experts only
    (wam debug) backtrack all
         local[367]: $debug_exec_cmd/6
         local[352]: repeat/0
         local[331]: $debug_port1/6
         local[303]: $catch_internal1/5
         local[276]: $debug_call1/8
         local[250]: $catch_internal1/5
         local[223]: $debug_call1/8
         local[197]: $catch_internal1/5
         local[170]: $debug_call1/8
         local[144]: $catch_internal1/5
         local[117]: $debug_call1/8
          local[87]: $$top_level2/0_$aux4/3
          local[66]: repeat/0
          local[40]: $catch_internal1/5
          local[26]: repeat/0
    
    opened by whowillbellthecat 1
Owner
Daniel Diaz
Daniel Diaz
Compiler Design Project: Simulation of front-end phase of C Compiler involving switch-case construct.

CSPC41 Compiler Design Project Assignment Compiler Design Project: Simulation of front-end phase of C Compiler involving switch-case construct. Using

Adeep Hande 1 Dec 15, 2021
A Small C Compiler

8cc C Compiler Note: 8cc is no longer an active project. The successor is chibicc. 8cc is a compiler for the C programming language. It's intended to

Rui Ueyama 5.8k Jan 8, 2023
A C compiler for LLVM. Supports C++11/14/1z C11

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies

LLVM 17.5k Jan 8, 2023
Take your first step in writing a compiler.

first-step Take your first step in writing a compiler. Building from Source Before building first-step, please make sure you have installed the follow

PKU Compiler Course 28 Aug 20, 2022
NCC is an ANSI/ISO-compliant optimizing C compiler.

The compiler is retargetable by design, but, at present, it only produces binaries for Linux/x86_64. As the compiler ABI differs somewhat from the System V ABI used by Linux, its code cannot be linked against Linux system libraries. It does, however, provide its own (incomplete) standard ANSI/Posix C library.

Charles E. Youse 0 Apr 1, 2022
nanoc is a tiny subset of C and a tiny compiler that targets 32-bit x86 machines.

nanoc is a tiny subset of C and a tiny compiler that targets 32-bit x86 machines. Tiny? The only types are: int (32-bit signed integer) char (8-

Ajay Tatachar 19 Nov 28, 2022
Smaller C is a simple and small single-pass C compiler

Smaller C is a simple and small single-pass C compiler, currently supporting most of the C language common between C89/ANSI C and C99 (minus some C89 and plus some C99 features).

Alexey Frunze 1.2k Jan 7, 2023
Microvm is a virtual machine and compiler

The aim of this project is to create a stack based language and virtual machine for microcontrollers. A mix of approaches is used. Separate memory is used for program and variable space (Harvard architecture). An interpreter, virtual machine and compiler are available. A demostration of the interpreter in action is presented below.

null 10 Aug 14, 2022
yadcc - Yet Another Distributed C++ Compiler

Yet Another Distributed C++ Compiler. yadcc是一套腾讯广告自研的分布式编译系统,用于支撑腾讯广告的日常开发及流水线。相对于已有的同类解决方案,我们针对实际的工业生产环境做了性能、可靠性、易用性等方面优化。

Tencent 276 Dec 29, 2022
Aheui JIT compiler for PC and web

아희짓 개요 아희짓은 아희 언어를 위한 JIT (Just in Time) 컴파일러입니다. 어셈블러와 유틸 라이브러리외에 외부 라이브러리에 전혀 의존하지 않고 JIT을 바닥부터 구현합니다. 지원 환경 64비트 windows, mac, linux (x86 아키텍쳐) 웹어셈

Sunho Kim 28 Sep 23, 2022
C implementation of the Tiny BASIC compiler found in an article by Dr. Austin Henley

Teeny Tiny Basic A C implementation of the Tiny BASIC compiler found in this article and this github repo by Dr. Austin Henley. I did pretty well in A

Gavin Morris 7 Oct 4, 2022
bcc is an interactive compiler of a language called b.

bcc is an interactive compiler of a language called b.

kparc 18 Nov 7, 2022
This is a compiler written from scratch in C

C Compiler This is a compiler written from scratch in C, with fully supporting C18 as a goal. It can currently compile itself, and most simple program

null 29 Jan 6, 2023
mrcceppc is a reimplementation project for the Metrowerks mwcceppc compiler.

Compiler | mrcceppc mrcceppc is a reimplementation project for the Metrowerks mwcceppc compiler. Compiling Run generate_{version}.bat for which versio

null 9 Nov 21, 2022
A C header that allow users to compile brainfuck programs within a C compiler.

brainfuck.h A C header that allow users to compile brainfuck programs within a C compiler. You can insert the header into the top of your brainfuck so

null 1 Dec 30, 2022
Gilbraltar is a version of the OCaml compiler to be able to build a MirageOS for RaspberryPi 4.

Gilbraltar is a version of the OCaml compiler to be able to build a MirageOS for RaspberryPi 4. It's a work in progress repository to provide a dune's toolchain (as ocaml-freestanding) specialized for Raspberry Pi 4.

Calascibetta Romain 49 Oct 30, 2022
NaiveCC: a compiler frontend for a subset of C

NaiveCC: a compiler frontend for a subset of C This is a toy compiler frontend for a subset of the C programming language based on the LR(1) parsing t

Yuxiang Wei 1 Nov 15, 2021
A LLVM and Clang compiler toolchain built for kernel development

Cosmic-Clang Toolchain This is a LLVM and Clang compiler toolchain built for kernel development. Builds are always made from the latest LLVM sources r

Ǥђ๏ຮ₮⌁Ⲙครtє࿐ 0 Apr 12, 2022
A compiler written in C++ to convert .hoi code to hoi4 code

What is HC4? HC4 is a compiler that converts .hoic filenames to Hearts of Iron IV's .txt. Usage Use hc4 in the terminal (./hc4 if on Unix) and it will

SaCode 1 Jul 31, 2022