diff --git a/Makefile b/Makefile index 3631865..3233429 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -OBJS = grendel.o +OBJS = naegling.o ifeq ($(BUILD_MODE),debug) CFLAGS += -g -O0 @@ -9,17 +9,17 @@ else ifeq ($(BUILD_MODE),run) else ifeq ($(BUILD_MODE),profile) CFLAGS += -g -pg -fprofile-arcs -ftest-coverage LDFLAGS += -pg -fprofile-arcs -ftest-coverage - EXTRA_CLEAN += grendel.gcda grendel.gcno $(PROJECT_ROOT)gmon.out - EXTRA_CMDS = rm -rf grendel.gcda + EXTRA_CLEAN += naegling.gcda naegling.gcno $(PROJECT_ROOT)gmon.out + EXTRA_CMDS = rm -rf naegling.gcda else $(error Build mode $(BUILD_MODE) not supported by this Makefile) endif SRC_DIR=$(PROJECT_ROOT)/src/c -all: grendel +all: naegling -grendel: $(OBJS) +naegling: $(OBJS) $(CXX) $(LDFLAGS) -o $@ $^ $(EXTRA_CMDS) @@ -30,4 +30,4 @@ grendel: $(OBJS) $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $< clean: - rm -fr grendel $(OBJS) $(EXTRA_CLEAN) + rm -fr naegling $(OBJS) $(EXTRA_CLEAN) diff --git a/README.md b/README.md index f5e117d..e5cc664 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# grendel +# naegling -A reimplementation of [Beowulf](https://git.journeyman.cc/simon/beowulf) bootstrapped in C, with a compiler following, basically, [Abdulaziz Ghuloum's recipe](https://bernsteinbear.com/assets/img/11-ghuloum.pdf). +A compiler for [Beowulf](https://git.journeyman.cc/simon/beowulf) following, basically, [Abdulaziz Ghuloum's recipe](https://bernsteinbear.com/assets/img/11-ghuloum.pdf) and [Noah Zentzis' implementation thereof](https://generalproblem.net/lets_build_a_compiler/). ## Memory model diff --git a/src/c/day1.c b/src/c/day1.c index 28ed48d..b1c7432 100644 --- a/src/c/day1.c +++ b/src/c/day1.c @@ -1,7 +1,7 @@ /** * day1.c * - * Grendel: a compiling Beowulf reimplementation. + * Naegling: a compiling Beowulf reimplementation. * * Day 1 of work towards a compiler... eventually... * diff --git a/src/c/error.c b/src/c/error.c index 9515e8c..7be53fa 100644 --- a/src/c/error.c +++ b/src/c/error.c @@ -1,7 +1,7 @@ /** * error.c * - * Grendel: a compiling Beowulf reimplementation. + * Naegling: a compiling Beowulf reimplementation. * * The error handling subsystem. * diff --git a/src/c/error.h b/src/c/error.h index f603941..6ae68fb 100644 --- a/src/c/error.h +++ b/src/c/error.h @@ -1,7 +1,7 @@ /** * error.h * - * Grendel: a compiling Beowulf reimplementation. + * Naegling: a compiling Beowulf reimplementation. * * The error handling subsystem. * @@ -13,8 +13,8 @@ * Licensed under GPL version 2.0, or, at your option, any later version. */ -#ifndef __grendel_error_h -#define __grendel_error_h +#ifndef __naegling_error_h +#define __naegling_error_h #include diff --git a/src/c/lisp.c b/src/c/lisp.c index 8b19cd2..ea4ce6b 100644 --- a/src/c/lisp.c +++ b/src/c/lisp.c @@ -1,7 +1,7 @@ /** * lisp.c * - * Grendel: a compiling Beowulf reimplementation. + * Naegling: a compiling Beowulf reimplementation. * * The compiler... eventually.. * diff --git a/src/c/memory.h b/src/c/memory.h index 6fe3c6d..2ed4a9a 100644 --- a/src/c/memory.h +++ b/src/c/memory.h @@ -1,7 +1,7 @@ /** * memory.h * - * Grendel: a compiling Beowulf reimplementation. + * Naegling: a compiling Beowulf reimplementation. * * The memory management subsystem. * @@ -9,8 +9,8 @@ * Licensed under GPL version 2.0, or, at your option, any later version. */ -#ifndef __grendel_memory_h -#define __grendel_memory_h +#ifndef __naegling_memory_h +#define __naegling_memory_h #include diff --git a/src/c/naegling.c b/src/c/naegling.c new file mode 100644 index 0000000..5a3b302 --- /dev/null +++ b/src/c/naegling.c @@ -0,0 +1,44 @@ +/** + * + * naegling.c + * + * Naegling: a compiling Beowulf reimplementation. + * + * The memory management subsystem. + * + * (c) 2026 Simon Brooke + * Licensed under GPL version 2.0, or, at your option, any later version. + */ + +#include +#include +#include + +#include "memory.h" +#include "version.h" + +__attribute__((__cdecl__)) +extern int lisp_entry(); + + +void showbits( unsigned int x ) +{ + int i=0; + for (i = (sizeof(int) * 8) - 1; i >= 0; i--) + { + putchar(x & (1u << i) ? '1' : '0'); + } + printf("\n"); +} + +int main(int argc, char **argv) { + + printf( "Naegling, a compiler for Beowulf: version %s\n", VERSION); + + int val = lisp_entry(); + printf("%d\n", val); + return 0; +} + + return 0; +} diff --git a/src/c/version.h b/src/c/version.h index 17656c8..fcce6e1 100644 --- a/src/c/version.h +++ b/src/c/version.h @@ -1,14 +1,14 @@ /** * version.h * - * Grendel: a compiling Beowulf reimplementation. + * Naegling: a compiling Beowulf reimplementation. * * (c) 2026 Simon Brooke * Licensed under GPL version 2.0, or, at your option, any later version. */ -#ifndef __grendel_version_h -#define __grendel_version_h +#ifndef __naegling_version_h +#define __naegling_version_h #define VERSIOM "Aelfhere" diff --git a/src/guile/memory.scm b/src/guile/memory.scm index f92a918..7911ff4 100644 --- a/src/guile/memory.scm +++ b/src/guile/memory.scm @@ -2,7 +2,7 @@ ;; ;; memory.scm ;; -;; Grendel: a compiling Beowulf reimplementation. +;; Naegling: a compiling Beowulf reimplementation. ;; ;; The memory management subsystem. ;;