Renamed the whole project from Grendel (Beowulf's opponent) to Naegling (Beowulf's sword).
This commit is contained in:
parent
69d762645a
commit
114c64501a
10 changed files with 65 additions and 21 deletions
12
Makefile
12
Makefile
|
|
@ -1,6 +1,6 @@
|
||||||
PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||||
|
|
||||||
OBJS = grendel.o
|
OBJS = naegling.o
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),debug)
|
ifeq ($(BUILD_MODE),debug)
|
||||||
CFLAGS += -g -O0
|
CFLAGS += -g -O0
|
||||||
|
|
@ -9,17 +9,17 @@ else ifeq ($(BUILD_MODE),run)
|
||||||
else ifeq ($(BUILD_MODE),profile)
|
else ifeq ($(BUILD_MODE),profile)
|
||||||
CFLAGS += -g -pg -fprofile-arcs -ftest-coverage
|
CFLAGS += -g -pg -fprofile-arcs -ftest-coverage
|
||||||
LDFLAGS += -pg -fprofile-arcs -ftest-coverage
|
LDFLAGS += -pg -fprofile-arcs -ftest-coverage
|
||||||
EXTRA_CLEAN += grendel.gcda grendel.gcno $(PROJECT_ROOT)gmon.out
|
EXTRA_CLEAN += naegling.gcda naegling.gcno $(PROJECT_ROOT)gmon.out
|
||||||
EXTRA_CMDS = rm -rf grendel.gcda
|
EXTRA_CMDS = rm -rf naegling.gcda
|
||||||
else
|
else
|
||||||
$(error Build mode $(BUILD_MODE) not supported by this Makefile)
|
$(error Build mode $(BUILD_MODE) not supported by this Makefile)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SRC_DIR=$(PROJECT_ROOT)/src/c
|
SRC_DIR=$(PROJECT_ROOT)/src/c
|
||||||
|
|
||||||
all: grendel
|
all: naegling
|
||||||
|
|
||||||
grendel: $(OBJS)
|
naegling: $(OBJS)
|
||||||
$(CXX) $(LDFLAGS) -o $@ $^
|
$(CXX) $(LDFLAGS) -o $@ $^
|
||||||
$(EXTRA_CMDS)
|
$(EXTRA_CMDS)
|
||||||
|
|
||||||
|
|
@ -30,4 +30,4 @@ grendel: $(OBJS)
|
||||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
|
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -fr grendel $(OBJS) $(EXTRA_CLEAN)
|
rm -fr naegling $(OBJS) $(EXTRA_CLEAN)
|
||||||
|
|
|
||||||
|
|
@ -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
|
## Memory model
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* day1.c
|
* day1.c
|
||||||
*
|
*
|
||||||
* Grendel: a compiling Beowulf reimplementation.
|
* Naegling: a compiling Beowulf reimplementation.
|
||||||
*
|
*
|
||||||
* Day 1 of work towards a compiler... eventually...
|
* Day 1 of work towards a compiler... eventually...
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* error.c
|
* error.c
|
||||||
*
|
*
|
||||||
* Grendel: a compiling Beowulf reimplementation.
|
* Naegling: a compiling Beowulf reimplementation.
|
||||||
*
|
*
|
||||||
* The error handling subsystem.
|
* The error handling subsystem.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* error.h
|
* error.h
|
||||||
*
|
*
|
||||||
* Grendel: a compiling Beowulf reimplementation.
|
* Naegling: a compiling Beowulf reimplementation.
|
||||||
*
|
*
|
||||||
* The error handling subsystem.
|
* The error handling subsystem.
|
||||||
*
|
*
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
* Licensed under GPL version 2.0, or, at your option, any later version.
|
* Licensed under GPL version 2.0, or, at your option, any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __grendel_error_h
|
#ifndef __naegling_error_h
|
||||||
#define __grendel_error_h
|
#define __naegling_error_h
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* lisp.c
|
* lisp.c
|
||||||
*
|
*
|
||||||
* Grendel: a compiling Beowulf reimplementation.
|
* Naegling: a compiling Beowulf reimplementation.
|
||||||
*
|
*
|
||||||
* The compiler... eventually..
|
* The compiler... eventually..
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* memory.h
|
* memory.h
|
||||||
*
|
*
|
||||||
* Grendel: a compiling Beowulf reimplementation.
|
* Naegling: a compiling Beowulf reimplementation.
|
||||||
*
|
*
|
||||||
* The memory management subsystem.
|
* The memory management subsystem.
|
||||||
*
|
*
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
* Licensed under GPL version 2.0, or, at your option, any later version.
|
* Licensed under GPL version 2.0, or, at your option, any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __grendel_memory_h
|
#ifndef __naegling_memory_h
|
||||||
#define __grendel_memory_h
|
#define __naegling_memory_h
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
|
||||||
44
src/c/naegling.c
Normal file
44
src/c/naegling.c
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* naegling.c
|
||||||
|
*
|
||||||
|
* Naegling: a compiling Beowulf reimplementation.
|
||||||
|
*
|
||||||
|
* The memory management subsystem.
|
||||||
|
*
|
||||||
|
* (c) 2026 Simon Brooke <simon@journeyman.cc>
|
||||||
|
* Licensed under GPL version 2.0, or, at your option, any later version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
/**
|
/**
|
||||||
* version.h
|
* version.h
|
||||||
*
|
*
|
||||||
* Grendel: a compiling Beowulf reimplementation.
|
* Naegling: a compiling Beowulf reimplementation.
|
||||||
*
|
*
|
||||||
* (c) 2026 Simon Brooke <simon@journeyman.cc>
|
* (c) 2026 Simon Brooke <simon@journeyman.cc>
|
||||||
* Licensed under GPL version 2.0, or, at your option, any later version.
|
* Licensed under GPL version 2.0, or, at your option, any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __grendel_version_h
|
#ifndef __naegling_version_h
|
||||||
#define __grendel_version_h
|
#define __naegling_version_h
|
||||||
|
|
||||||
#define VERSIOM "Aelfhere"
|
#define VERSIOM "Aelfhere"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
;;
|
;;
|
||||||
;; memory.scm
|
;; memory.scm
|
||||||
;;
|
;;
|
||||||
;; Grendel: a compiling Beowulf reimplementation.
|
;; Naegling: a compiling Beowulf reimplementation.
|
||||||
;;
|
;;
|
||||||
;; The memory management subsystem.
|
;; The memory management subsystem.
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue