catscript: núcleo C, stdlib (TOML), família de arquivos e front-end self-hosted

- Modelo de objetos Cat_Value + vtable (interfaces abstratas)
- VM de bytecode, sem GIL (VM por-thread, nativas como valores)
- Stdlib com TOML embutido (toml_parse/toml_encode)
- Família de arquivos: AbstractFile (abstrata), File::open, StringIO, BytesIO
- Front-end (lexer/parser/checker/compiler) implementado em catscript
- cpk (cat package manager) como primeiro programa; manifest package.toml
- Type hints advisory, inclusive DynSized() e sentinel_sized<...>
- 25/25 testes passando (make test)
This commit is contained in:
Minus committed 2026-11-16 01:27:44 +00:00
commit 52d118211f
69 files changed
+6938

No files matched your search

+78
View File
@@ -0,0 +1,78 @@
# Makefile -- catscript
#
# Naming rule: every function/type name in the sources encodes its path
# from the project root with '/' -> '_'. A function in a/b/c.h is named
# a_b_c_funcao(); a type there is A_B_C_MeuTipo. (Headers keep the
# `include/` root and sources the `src/` root out of the name, so
# include/cat/types/int.h and src/cat/types/int.c are both module
# `cat_types_int`.)
#
# Targets (run `make help` for the list):
# help show this list (default goal)
# all build the catscript binary
# test build and run the automated test suite
# clean remove build artifacts
CC ?= cc
CFLAGS ?= -std=c11 -Wall -Wextra -O2 -Wno-unused-parameter -D_DEFAULT_SOURCE
CPPFLAGS += -Iinclude
LDFLAGS ?=
LDLIBS ?= -lm
BUILD := build/catscript
BIN := $(BUILD)/catscript
SRCS := \
src/main.c \
src/cat/error.c \
src/cat/value.c \
src/cat/bytecode.c \
src/cat/lexer.c \
src/cat/compiler.c \
src/cat/vm.c \
src/cat/module.c \
src/cat/types/nil.c \
src/cat/types/bool.c \
src/cat/types/number.c \
src/cat/types/int.c \
src/cat/types/float.c \
src/cat/types/byte.c \
src/cat/types/char.c \
src/cat/types/ascii_text.c \
src/cat/types/utf8_text.c \
src/cat/types/text.c \
src/cat/types/table.c \
src/cat/types/function.c \
src/cat/types/native.c \
src/cat/types/file.c \
src/cat/stdlib/stdlib.c \
src/cat/stdlib/toml.c \
src/cat/stdlib/build.c
OBJS := $(patsubst src/%.c,$(BUILD)/%.o,$(SRCS))
.PHONY: help all test clean examples
# Default goal: print the help.
help:
@echo "catscript build targets:"
@echo " make all - build the catscript binary ($(BIN))"
@echo " make test - build and run the automated test suite"
@echo " make clean - remove build artifacts"
@echo " make help - show this help (default goal)"
all: $(BIN)
$(BIN): $(OBJS)
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
$(BUILD)/%.o: src/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
test: $(BIN)
@sh tests/run_tests.sh
clean:
rm -rf build/catscript