#ifndef FVM_COMPILER_H
#define FVM_COMPILER_H

#include <stddef.h>
#include <stdbool.h>
#include <fvm-c/update.h>

typedef struct fvm_compiler fvm_compiler_t;

typedef struct {
    fvm_buf_t buf;
} fvm_output_t;

fvm_compiler_t *fvm_compiler_acquire(const char *api_table);
void fvm_compiler_release(fvm_compiler_t *compiler);

bool fvm_compiler_load_re(fvm_compiler_t *compiler, const char *re, size_t re_len);
bool fvm_compiler_dump_re(fvm_compiler_t *compiler, char **out, size_t *out_len);

fvm_output_t *fvm_compile(fvm_compiler_t *compiler, const char *text);
fvm_output_t *fvm_serialize(fvm_output_t *output, bool diff, long base, long target);
void fvm_output_destroy(fvm_output_t *output);

fvm_update_t *fvm_dump(fvm_framework_t *fw);

#endif
