aboutsummaryrefslogtreecommitdiffstats
path: root/src/aup.h
blob: 75047aff3ccc32e1c829323640dd6a2b9cf0f033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef AUP_H
#define AUP_H
#include <stdbool.h>
#include <stddef.h>

/* aup: source text to a Pure module (Pure docs/design/008-module-format.md). */
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