From 076d528bfaa55b71f9653c0579723ff565db5e7f Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 18 Jan 2024 15:15:04 +0100 Subject: BLoCade --- makefile | 13 +++++++++---- readme.md | 11 ++++++++--- test/run | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/makefile b/makefile index 0431d3c..d870433 100644 --- a/makefile +++ b/makefile @@ -7,10 +7,10 @@ TG = ctags BUILD = ${CURDIR}/build SRC = ${CURDIR}/src INC = ${CURDIR}/inc -SRCS = $(wildcard $(SRC)/*.c) +SRCS = $(wildcard $(SRC)/*.c) $(SRC)/cmdline.c OBJS = $(patsubst $(SRC)/%.c, $(BUILD)/%.o, $(SRCS)) -CFLAGS_DEBUG = -fsanitize=leak +CFLAGS_DEBUG = -fsanitize=address,leak,undefined -g -O0 CFLAGS_WARNINGS = -Wall -Wextra -Wshadow -Wpointer-arith -Wwrite-strings -Wredundant-decls -Wnested-externs -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wswitch-default -Wswitch-enum -Wunreachable-code -Wundef -Wold-style-definition -pedantic -Wno-switch-enum CFLAGS = $(CFLAGS_WARNINGS) -std=c99 -Ofast -I$(INC) @@ -22,7 +22,7 @@ ifeq ($(PREFIX),) PREFIX := /usr/local endif -all: genopts compile +all: compile full: all sync @@ -41,7 +41,12 @@ sync: # Ugly hack @$(MAKE) $(BUILD)/bloc --always-make --dry-run | grep -wE 'gcc|g\+\+' | grep -w '\-c' | jq -nR '[inputs|{directory:".", command:., file: match(" [^ ]+$$").string[1:]}]' >compile_commands.json @$(TG) -R --exclude=.git --exclude=build . -$(BUILD)/%.o: $(SRC)/%.c +$(SRC)/cmdline.c: + @gengetopt -i ${CURDIR}/options.ggo -G --output-dir=$(BUILD) + @printf '%s\n%s\n%s\n%s' '#pragma GCC diagnostic push' '#pragma GCC diagnostic ignored "-Wcast-qual"' "$$(cat $(BUILD)/cmdline.c)" '#pragma GCC diagnostic pop' >$(SRC)/cmdline.c + @cp $(BUILD)/cmdline.h $(SRC)/cmdline.h + +$(BUILD)/%.o: $(SRC)/%.c | $(SRC)/cmdline.c @$(CC) -c -o $@ $(CFLAGS) $< $(BUILD)/bloc: $(OBJS) diff --git a/readme.md b/readme.md index 87db161..78d6fb4 100644 --- a/readme.md +++ b/readme.md @@ -1,9 +1,14 @@ # BLoC This project proposes a file format for programs encoded in binary -lambda calculus (BLC). Its main goal is minimal redundancy and therefore -allowing maximal optimization. The included `bloc` tool converts BLC to -BLoC and heavily reduces its size. +lambda calculus (BLC). Its main goal is to minimize redundancy by +incorporating reference-based term sharing, while remaining easy to work +with. The included `bloc` tool converts BLC to BLoC and greatly reduces +its size. + +The additional tool `blocade` (found in +[BLoCade](https://github.com/marvinborner/blocade)) can compile `.bloc` +files to various targets, including a shared pure BLC representation. ## Results diff --git a/test/run b/test/run index b92629b..f33db65 100755 --- a/test/run +++ b/test/run @@ -3,7 +3,7 @@ set -e FAIL="\033[0;31m[FAIL]\033[0m " -SUCC="\033[0;32m[SUCC]\033[0m " +SUCC="\033[0;32m[ OK ]\033[0m " for file in *.blc; do ../build/bloc --from-blc -i "$file" -o ../build/"$file".bloc -- cgit v1.2.3