Added tons of AI generated docs and a lot of cleanups. No code changes. (0.41.5)
This commit is contained in:
parent
24c54fba41
commit
4e69a3ce63
151 changed files with 3897 additions and 427 deletions
39
src/parser.h
39
src/parser.h
|
|
@ -8,14 +8,8 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Parse a .fun source file and compile it into entry bytecode.
|
||||
* Minimal support:
|
||||
* - Optional shebang on the first line.
|
||||
* - Optional single function wrapper: fun <ident>() { ... }
|
||||
* - print("...") statements inside function or at top-level.
|
||||
* Produces bytecode that executes all dApache-2.0overed print statements and halts.
|
||||
*
|
||||
* Returns: newly allocated Bytecode*, or NULL on error.
|
||||
* @file parser.h
|
||||
* @brief Public API for parsing Fun source into bytecode.
|
||||
*/
|
||||
|
||||
#ifndef FUN_PARSER_H
|
||||
|
|
@ -23,12 +17,37 @@
|
|||
|
||||
#include "bytecode.h"
|
||||
|
||||
/**
|
||||
* @brief Parse a .fun source file and compile it into a bytecode chunk.
|
||||
*
|
||||
* The parser accepts an optional shebang on the first line and supports a
|
||||
* minimal top-level or single-function program model. The returned bytecode
|
||||
* will execute discovered statements (e.g., print) and then halt.
|
||||
*
|
||||
* @param path Filesystem path to the .fun source file. Must be a
|
||||
* null-terminated UTF-8 string.
|
||||
* @return Newly allocated Bytecode instance on success, or NULL on error.
|
||||
*/
|
||||
Bytecode *parse_file_to_bytecode(const char *path);
|
||||
|
||||
/* Parse source provided as a single string buffer (for REPL, tests, etc.). */
|
||||
/**
|
||||
* @brief Parse source from a provided string buffer (REPL/tests helper).
|
||||
*
|
||||
* @param source Null-terminated Fun program text.
|
||||
* @return Newly allocated Bytecode instance on success, or NULL on error.
|
||||
*/
|
||||
Bytecode *parse_string_to_bytecode(const char *source);
|
||||
|
||||
/* Query the last parser error (1 if present, 0 if none). */
|
||||
/**
|
||||
* @brief Retrieve information about the last parser error, if any.
|
||||
*
|
||||
* @param msgBuf Output buffer to receive a human-readable error message.
|
||||
* @param msgCap Capacity of msgBuf in bytes.
|
||||
* @param outLine Optional output: 1-based line number where the error occurred.
|
||||
* @param outCol Optional output: 1-based column number where the error occurred.
|
||||
* @return 1 if an error was present and fields were populated, 0 if there is
|
||||
* no recorded error.
|
||||
*/
|
||||
int parser_last_error(char *msgBuf, unsigned long msgCap, int *outLine, int *outCol);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue