aboutsummaryrefslogtreecommitdiffstats
path: root/src/aup.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-25 11:05:51 +0100
committereunhhu <[email protected]>2026-09-25 11:05:51 +0100
commit3e35975ee9120042baa0e8fe2bb2d52311204e84 (patch)
treec56902403251c964f493e69df7e343167e981a81 /src/aup.h
parente058795152fdb678aa71b67acd7a0fb44dabe747 (diff)
downloadaup-3e35975ee9120042baa0e8fe2bb2d52311204e84.tar.gz
aup-3e35975ee9120042baa0e8fe2bb2d52311204e84.zip
Compile v0a programs to verified Pure modules
aup check/build parse states, key inputs, views and handlers (with if/else and else-if), resolve names, generate forward-only stack code and encode a Pure module v1 deterministically. Diagnostics carry file:line:column. make check loads every module with Pure's verifier, checks determinism, 20 diagnostics and accepted forms, replacement by name, 600 generated programs and damaged sources (every emitted module verifies), and replays random event scripts against the workbench Zig engine: 16,667 snapshots across counter, toggle, charge, else-if and fault programs matched, including 921 failed events. The sanitizer-built compiler passes the same checks.
Diffstat (limited to 'src/aup.h')
-rw-r--r--src/aup.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/aup.h b/src/aup.h
new file mode 100644
index 0000000..aa48daf
--- /dev/null
+++ b/src/aup.h
@@ -0,0 +1,19 @@
+#ifndef AUP_H
+#define AUP_H
+#include <stdbool.h>
+#include <stddef.h>
+
+/* aup v0a: source text to a Pure module v1 (Pure docs/design/008). */
+enum { AUP_SOURCE_LIMIT = 32768, AUP_MESSAGE = 160 };
+
+typedef struct {
+ int line, column;
+ char message[AUP_MESSAGE];
+} AupDiagnostic;
+
+/* Compile source into a newly allocated module (free with free()). The same
+ * source always produces the same bytes. On failure *module is NULL and the
+ * diagnostic names the first error. */
+bool aup_compile(const char *source, size_t length, unsigned char **module, size_t *size,
+ AupDiagnostic *error);
+#endif