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:
commit
52d118211f
69 files changed
+6938
No files matched your search
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* cat/module.h -- Cat_Module, a unit of catscript code.
|
||||
*
|
||||
* Naming rule: symbols declared here are cat_module_* / CAT_MODULE_*.
|
||||
* (Path of this header below include/ is `cat/module`, so cat_module_*.)
|
||||
*
|
||||
* A module owns a name and a compiled entry prototype. Loading a module
|
||||
* is how an embedder turns catscript source into something callable.
|
||||
*/
|
||||
#ifndef CAT_MODULE_H
|
||||
#define CAT_MODULE_H
|
||||
|
||||
#include "cat/value.h"
|
||||
#include "cat/error.h"
|
||||
|
||||
struct CAT_BYTECODE_Function;
|
||||
|
||||
/* CAT_MODULE_Module == Cat_Module.
|
||||
* One compilable unit: a name plus its top-level function prototype. */
|
||||
typedef struct CAT_MODULE_Module {
|
||||
char *name;
|
||||
struct CAT_BYTECODE_Function *main;
|
||||
} CAT_MODULE_Module;
|
||||
|
||||
/* Create an empty module with the given name (name is copied). */
|
||||
CAT_MODULE_Module *cat_module_new(const char *name);
|
||||
|
||||
/* Compile catscript source text into this module. */
|
||||
int cat_module_compile(CAT_MODULE_Module *mod, const char *source,
|
||||
CAT_ERROR_Error *err);
|
||||
|
||||
/* Execute the module's main prototype; `out` receives its return value. */
|
||||
int cat_module_run(CAT_MODULE_Module *mod, CAT_VALUE_Value **out,
|
||||
CAT_ERROR_Error *err);
|
||||
|
||||
/* Free a module. */
|
||||
void cat_module_free(CAT_MODULE_Module *mod);
|
||||
|
||||
#endif /* CAT_MODULE_H */
|
||||
Reference in new issue
Block a user