compiler.h File Reference
Exported methods for the source compiler. More...
#include "object.h"
Include dependency graph for compiler.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
KrkCodeObject * | krk_compile (const char *src, const char *fileName) |
Compile a string to a code object. More... | |
Detailed Description
Exported methods for the source compiler.
Definition in file compiler.h.
Function Documentation
◆ krk_compile()
KrkCodeObject* krk_compile | ( | const char * | src, |
const char * | fileName | ||
) |
Compile a string to a code object.
Compiles the source string 'src' into a code object.
- Parameters
-
src Source code string to compile. fileName Path name of the source file or a representative string like "<stdin>"
- Returns
- The code object resulting from the compilation, or NULL if compilation failed.
Compile a string to a code object.
Parses source code and compiles it to bytecode.
Raises SyntaxError on error and returns NULL if the source failed to compile.
- Parameters
-
src Code string to compile. Should be a module body or repl line. fileName Used to describe where the source string came from in error messages.
- Returns
- A compiled code object, or NULL on error.
- Exceptions
-
SyntaxError if src
could not be compiled.
Definition at line 4129 of file compiler.c.