diff options
Diffstat (limited to 'js/scripting-lang/docs/baba-yaga/0.0.1/global.html')
-rw-r--r-- | js/scripting-lang/docs/baba-yaga/0.0.1/global.html | 4787 |
1 files changed, 4787 insertions, 0 deletions
diff --git a/js/scripting-lang/docs/baba-yaga/0.0.1/global.html b/js/scripting-lang/docs/baba-yaga/0.0.1/global.html new file mode 100644 index 0000000..4b02d15 --- /dev/null +++ b/js/scripting-lang/docs/baba-yaga/0.0.1/global.html @@ -0,0 +1,4787 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <title>Global - Documentation</title> + + <script src="scripts/prettify/prettify.js"></script> + <script src="scripts/prettify/lang-css.js"></script> + <!--[if lt IE 9]> + <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + <link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> + <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> +</head> +<body> + +<input type="checkbox" id="nav-trigger" class="nav-trigger" /> +<label for="nav-trigger" class="navicon-button x"> + <div class="navicon"></div> +</label> + +<label for="nav-trigger" class="overlay"></label> + +<nav> + <li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Tutorials</li><li class="nav-item"><a href="tutorial-00_Introduction.html">00_Introduction</a></li><li class="nav-item"><a href="tutorial-01_Function_Calls.html">01_Function_Calls</a></li><li class="nav-item"><a href="tutorial-02_Function_Composition.html">02_Function_Composition</a></li><li class="nav-item"><a href="tutorial-03_Table_Operations.html">03_Table_Operations</a></li><li class="nav-item"><a href="tutorial-04_Currying.html">04_Currying</a></li><li class="nav-item"><a href="tutorial-05_Pattern_Matching.html">05_Pattern_Matching</a></li><li class="nav-item"><a href="tutorial-06_Immutable_Tables.html">06_Immutable_Tables</a></li><li class="nav-item"><a href="tutorial-07_Function_References.html">07_Function_References</a></li><li class="nav-item"><a href="tutorial-08_Combinators.html">08_Combinators</a></li><li class="nav-item"><a href="tutorial-09_Expression_Based.html">09_Expression_Based</a></li><li class="nav-item"><a href="tutorial-10_Tables_Deep_Dive.html">10_Tables_Deep_Dive</a></li><li class="nav-item"><a href="tutorial-11_Standard_Library.html">11_Standard_Library</a></li><li class="nav-item"><a href="tutorial-12_IO_Operations.html">12_IO_Operations</a></li><li class="nav-item"><a href="tutorial-13_Error_Handling.html">13_Error_Handling</a></li><li class="nav-item"><a href="tutorial-14_Advanced_Combinators.html">14_Advanced_Combinators</a></li><li class="nav-item"><a href="tutorial-15_Integration_Patterns.html">15_Integration_Patterns</a></li><li class="nav-item"><a href="tutorial-16_Best_Practices.html">16_Best_Practices</a></li><li class="nav-item"><a href="tutorial-README.html">README</a></li><li class="nav-heading"><a href="global.html">Globals</a></li><li class="nav-item"><span class="nav-item-type type-member">M</span><span class="nav-item-name"><a href="global.html#callStackTracker">callStackTracker</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#debugError">debugError</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#debugLog">debugLog</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#executeFile">executeFile</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#initializeStandardLibrary">initializeStandardLibrary</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#interpreter">interpreter</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#lexer">lexer</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#main">main</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#parser">parser</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#readFile">readFile</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#run">run</a></span></li> +</nav> + +<div id="main"> + + <h1 class="page-title">Global</h1> + + + + + + + +<section> + +<header> + + <h2> + + </h2> + + +</header> + +<article> + <div class="container-overview"> + + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</dl> + + + + + </div> + + + + + + + + + + + + + <h3 class="subsection-title">Members</h3> + + + +<div class="section-members"> +<h4 class="name" id="callStackTracker"><span class="type-signature">(constant) </span>callStackTracker<span class="type-signature"></span></h4> + + + + +<div class="description"> + Tracks function calls to help identify infinite recursion +and deep call stacks that cause stack overflow errors. This is essential +for debugging the interpreter's recursive evaluation of AST nodes. + +The tracker maintains a stack of function calls with timestamps and context +information, counts function calls to identify hot paths, and detects +potential infinite recursion by monitoring stack depth. + +This tool is particularly important for the combinator-based architecture +where function calls are the primary execution mechanism, and +nested expressions can lead to deep call stacks. The tracker helps identify +when the combinator translation creates unexpectedly deep call chains, +enabling optimization of the function composition and application patterns. + +The tracker provides detailed statistics about function call patterns, +helping developers understand the execution characteristics of their code +and identify potential performance bottlenecks in the combinator evaluation. +</div> + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lang.js.html">lang.js</a>, <a href="lang.js.html#line2758">line 2758</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + +</div> + + + + + + <h3 class="subsection-title">Methods</h3> + + + +<div class="section-method"> + + + + <h4 class="name" id="debugError"><span class="type-signature"></span>debugError<span class="signature">(message, error<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> + + + + + +<div class="description"> + Logs debug error messages to console when DEBUG environment variable is set. +Provides verbose error output during development while remaining silent in production. + +Debug functions are gated by the DEBUG environment variable, allowing for +verbose output during development and silent operation in production. This +approach makes it easy to trace execution and diagnose issues without +cluttering normal output. + +This function is particularly useful for debugging parsing and evaluation errors, +providing detailed context about where and why errors occur in the language +execution pipeline. +</div> + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lang.js.html">lang.js</a>, <a href="lang.js.html#line2728">line 2728</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + <th>Default</th> + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>message</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"> + Debug error message to log + + </td> + </tr> + + + + <tr> + + <td class="name"><code>error</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Error</code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + <td class="default"> + + null + + </td> + + + <td class="description last"> + Optional error object to log + + </td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +</div> + + +<div class="section-method"> + + + + <h4 class="name" id="debugLog"><span class="type-signature"></span>debugLog<span class="signature">(message, data<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> + + + + + +<div class="description"> + Logs debug messages to console when DEBUG environment variable is set. +Provides verbose output during development while remaining silent in production. + +Debug functions are gated by the DEBUG environment variable, allowing for +verbose output during development and silent operation in production. This +approach makes it easy to trace execution and diagnose issues without +cluttering normal output. + +This function is essential for debugging the combinator-based architecture, +allowing developers to trace how operators are translated to function calls +and how the interpreter executes these calls through the standard library. + +The function is designed to be lightweight and safe to call frequently, +making it suitable for tracing execution flow through nested +expressions and function applications. +</div> + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lang.js.html">lang.js</a>, <a href="lang.js.html#line2701">line 2701</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + <th>Default</th> + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>message</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"> + Debug message to log + + </td> + </tr> + + + + <tr> + + <td class="name"><code>data</code></td> + + + <td class="type"> + + +<span class="param-type"><code>*</code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + <td class="default"> + + null + + </td> + + + <td class="description last"> + Optional data to log with the message + + </td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +</div> + + +<div class="section-method"> + + + + <h4 class="name" id="executeFile"><span class="type-signature">(async) </span>executeFile<span class="signature">(filePath)</span><span class="type-signature"> → {Promise.<*>}</span></h4> + + + + + +<div class="description"> + Main entry point for file execution. Handles the complete language +pipeline: file reading, lexical analysis, parsing, and interpretation. + +This function orchestrates the entire language execution process: +1. Reads the source file using cross-platform I/O utilities +2. Tokenizes the source code using the lexer +3. Parses tokens into an AST using the combinator-based parser +4. Interprets the AST using the combinator-based interpreter + +The function provides comprehensive error handling and debug output at each +stage for transparency and troubleshooting. It also manages the call stack +tracker to provide execution statistics and detect potential issues. + +Supports both synchronous and asynchronous execution, with proper +error handling and process exit codes. This function demonstrates the +complete combinator-based architecture in action, showing how source code +is transformed through each stage of the language pipeline. + +The function enforces the .txt file extension requirement and provides +detailed error reporting with call stack statistics to help developers +understand execution behavior and diagnose issues. +</div> + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lang.js.html">lang.js</a>, <a href="lang.js.html#line2897">line 2897</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>filePath</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last"> + Path to the file to execute + + </td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + +<div class="section-throws"> +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc"> + For file reading, parsing, or execution errors + </div> + </dt> + <dd></dd> + <dt> + <dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type"><code>Error</code></span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + +</div> + + + +<div class="section-returns"> +<h5>Returns:</h5> + + + +<dl class="param-type"> + <dt> + Type: + </dt> + <dd> + +<span class="param-type"><code>Promise.<*></code></span> + + + </dd> +</dl> + + +<div class="param-desc"> + The result of executing the file +</div> + + +</div> + + + +</div> + + +<div class="section-method"> + + + + <h4 class="name" id="initializeStandardLibrary"><span class="type-signature"></span>initializeStandardLibrary<span class="signature">(scope)</span><span class="type-signature"></span></h4> + + + + + +<div class="description"> + Injects higher-order functions and combinator functions into the interpreter's global scope. +These functions provide functional programming utilities and implement the combinator foundation +that reduces parsing ambiguity by translating all operations to function calls. + +The standard library includes: +- Higher-order functions (map, compose, pipe, apply, filter, reduce, fold, curry) +- Arithmetic combinators (add, subtract, multiply, divide, modulo, power, negate) +- Comparison combinators (equals, notEquals, lessThan, greaterThan, lessEqual, greaterEqual) +- Logical combinators (logicalAnd, logicalOr, logicalXor, logicalNot) +- Enhanced combinators (identity, constant, flip, on, both, either) + +This approach ensures that user code can access these functions as if they were built-in, +without special syntax or reserved keywords. The combinator foundation allows the parser +to translate all operators to function calls, eliminating ambiguity while preserving syntax. + +Functions are written to check argument types at runtime since the language is dynamically +typed and does not enforce arity or types at parse time. The combinator functions are +designed to work seamlessly with the parser's operator translation, providing a consistent +and extensible foundation for all language operations. + +The standard library is the foundation of the combinator-based architecture. Each function +is designed to support partial application, enabling currying patterns and function composition. +This design choice enables functional programming patterns while maintaining +simplicity and consistency across all operations. + +Error handling is implemented at the function level, with clear error messages that help +users understand what went wrong and how to fix it. This includes type checking for +function arguments and validation of input data. +</div> + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lang.js.html">lang.js</a>, <a href="lang.js.html#line134">line 134</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>scope</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Object</code></span> + + + + </td> + + + + + + <td class="description last"> + The global scope object to inject functions into + + </td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + + + + + +</div> + + +<div class="section-method"> + + + + <h4 class="name" id="interpreter"><span class="type-signature"></span>interpreter<span class="signature">(ast, environment<span class="signature-attributes">opt</span>, initialState<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {*}</span></h4> + + + + + +<div class="description"> + Evaluates an AST by walking through each node and performing the +corresponding operations. Manages scope, handles function calls, and supports +both synchronous and asynchronous operations. + +The interpreter implements a combinator-based architecture where all operations +are executed through function calls to standard library combinators. This design +reduces parsing ambiguity while preserving intuitive syntax. The parser translates +all operators (+, -, *, /, etc.) into FunctionCall nodes that reference combinator +functions, ensuring consistent semantics across all operations. + +Key architectural features: +- Combinator Foundation: All operations are function calls to standard library combinators +- Scope Management: Prototypal inheritance for variable lookup and function definitions +- Forward Declaration: Recursive functions are supported through placeholder creation +- Error Handling: Comprehensive error detection and reporting with call stack tracking +- Debug Support: Optional debug mode for development and troubleshooting +- IO Operations: Support for input/output operations through environment interface + +The interpreter processes legacy operator expressions (PlusExpression, MinusExpression, etc.) +for backward compatibility, but the parser now generates FunctionCall nodes for all operators, +which are handled by the standard library combinator functions. This ensures that all +operations follow the same execution model and can be extended by adding new combinator +functions to the standard library. + +The interpreter uses a global scope for variable storage and function definitions. +Each function call creates a new scope (using prototypal inheritance) to implement +lexical scoping. Immutability is enforced by preventing reassignment in the +global scope. + +The interpreter is split into three functions: evalNode (global), +localEvalNodeWithScope (for function bodies), and localEvalNode (for internal +recursion). This separation allows for correct scope handling and easier debugging. + +Recursive function support is implemented using a forward declaration pattern: +a placeholder function is created in the global scope before evaluation, allowing +the function body to reference itself during evaluation. + +The combinator foundation ensures that all operations are executed through +function calls, providing a consistent and extensible execution model. This +approach enables abstractions and reduces the need for special +handling of different operator types in the interpreter. + +The interpreter supports both synchronous and asynchronous operations. IO operations +like input and output can return Promises, allowing for non-blocking execution +when interacting with external systems or user input. +</div> + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lang.js.html">lang.js</a>, <a href="lang.js.html#line1370">line 1370</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + <th>Default</th> + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>ast</code></td> + + + <td class="type"> + + +<span class="param-type"><code><a href="global.html#ASTNode">ASTNode</a></code></span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"> + Abstract Syntax Tree to evaluate + + </td> + </tr> + + + + <tr> + + <td class="name"><code>environment</code></td> + + + <td class="type"> + + +<span class="param-type"><code><a href="global.html#Environment">Environment</a></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + <td class="default"> + + null + + </td> + + + <td class="description last"> + External environment for IO operations + + </td> + </tr> + + + + <tr> + + <td class="name"><code>initialState</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Object</code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + <td class="default"> + + {} + + </td> + + + <td class="description last"> + Initial state for the interpreter + + </td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + +<div class="section-throws"> +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc"> + For evaluation errors like division by zero, undefined variables, etc. + </div> + </dt> + <dd></dd> + <dt> + <dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type"><code>Error</code></span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + +</div> + + + +<div class="section-returns"> +<h5>Returns:</h5> + + + +<dl class="param-type"> + <dt> + Type: + </dt> + <dd> + +<span class="param-type"><code>*</code></span> + + + </dd> +</dl> + + +<div class="param-desc"> + The result of evaluating the AST, or a Promise for async operations +</div> + + +</div> + + + +</div> + + +<div class="section-method"> + + + + <h4 class="name" id="lexer"><span class="type-signature"></span>lexer<span class="signature">(input)</span><span class="type-signature"> → {Array.<<a href="global.html#Token">Token</a>>}</span></h4> + + + + + +<div class="description"> + The lexer performs lexical analysis by converting source code +into a stream of tokens. Each token represents a meaningful unit of the +language syntax, such as identifiers, literals, operators, and keywords. + +The lexer implements a character-by-character scanning approach with +lookahead for multi-character tokens. It maintains line and column +information for accurate error reporting and debugging. + +Key features: +- Handles whitespace and comments (single-line and multi-line) +- Recognizes all language constructs including operators, keywords, and literals +- Supports string literals with escape sequences +- Provides detailed position information for error reporting +- Cross-platform compatibility (Node.js, Bun, browser) +- Supports function composition with 'via' keyword +- Handles function references with '@' operator + +The lexer is designed to be robust and provide clear error messages +for malformed input, making it easier to debug syntax errors in user code. +It supports the combinator-based architecture by recognizing all operators +and special tokens needed for function composition and application. + +The lexer is the first step in the language processing pipeline and must +correctly identify all tokens that the parser will translate into function +calls. This includes operators that will become combinator function calls, +function references that enable higher-order programming, and special +keywords that support the functional programming paradigm. + +The lexer uses a state machine approach where each character type triggers +different parsing strategies. This design enables efficient tokenization +while maintaining clear separation of concerns for different token types. +The character-by-character approach allows for precise error reporting and +supports multi-character tokens like operators and string literals +with escape sequences. + +Error handling is designed to provide meaningful feedback by including +line and column information in error messages. This enables users to +quickly locate and fix syntax errors in their code. +</div> + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lexer.js.html">lexer.js</a>, <a href="lexer.js.html#line180">line 180</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>input</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last"> + The source code to tokenize + + </td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + +<div class="section-throws"> +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc"> + For unexpected characters or malformed tokens + </div> + </dt> + <dd></dd> + <dt> + <dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type"><code>Error</code></span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + +</div> + + + +<div class="section-returns"> +<h5>Returns:</h5> + + + +<dl class="param-type"> + <dt> + Type: + </dt> + <dd> + +<span class="param-type"><code>Array.<<a href="global.html#Token">Token</a>></code></span> + + + </dd> +</dl> + + +<div class="param-desc"> + Array of token objects with type, value, line, and column +</div> + + +</div> + + + +</div> + + +<div class="section-method"> + + + + <h4 class="name" id="main"><span class="type-signature">(async) </span>main<span class="signature">()</span><span class="type-signature"></span></h4> + + + + + +<div class="description"> + Processes command line arguments and executes the specified file. +Provides helpful error messages for incorrect usage. + +The language is designed for file execution only (no REPL), so the CLI +enforces this usage and provides helpful error messages for incorrect invocation. +The function validates that exactly one file path is provided and that the +file has the correct .txt extension. + +Exits with appropriate error codes for different failure scenarios. +</div> + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lang.js.html">lang.js</a>, <a href="lang.js.html#line2979">line 2979</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + + + + + + + + + + + + + + +</div> + + +<div class="section-method"> + + + + <h4 class="name" id="parser"><span class="type-signature"></span>parser<span class="signature">(tokens)</span><span class="type-signature"> → {<a href="global.html#ASTNode">ASTNode</a>}</span></h4> + + + + + +<div class="description"> + The parser implements a combinator-based architecture where all +operators are translated to function calls to standard library combinators. +This reduces parsing ambiguity while preserving the original syntax. + +The parser uses a recursive descent approach with proper operator precedence +handling. Each operator expression (e.g., x + y) is translated to a FunctionCall +node (e.g., add(x, y)) that will be executed by the interpreter using the +corresponding combinator function. + +Key architectural decisions: +- All operators become FunctionCall nodes to eliminate ambiguity +- Operator precedence is handled through recursive parsing functions +- Function calls are detected by looking for identifiers followed by expressions +- When expressions and case patterns are parsed with special handling +- Table literals and access are parsed as structured data +- Function composition uses 'via' keyword with right-associative precedence +- Function application uses juxtaposition with left-associative precedence + +The parser maintains a current token index and advances through the token +stream, building the AST bottom-up from primary expressions to logical +expressions. This approach ensures that all operations are consistently +represented as function calls, enabling the interpreter to use the combinator +foundation for execution. + +This design choice reduces the need for special operator handling in the +interpreter and enables abstractions through the combinator foundation. +All operations become function calls, providing a consistent and extensible +execution model that can be enhanced by adding new combinator functions. + +The parser implements a top-down recursive descent strategy where each +parsing function handles a specific precedence level. This approach ensures +that operator precedence is correctly enforced while maintaining clear +separation of concerns for different language constructs. + +Error handling is designed to provide meaningful feedback by including +context about what was expected and what was found. This enables users +to quickly identify and fix parsing errors in their code. +</div> + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line83">line 83</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>tokens</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Array.<<a href="global.html#Token">Token</a>></code></span> + + + + </td> + + + + + + <td class="description last"> + Array of tokens from the lexer + + </td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + +<div class="section-throws"> +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc"> + For parsing errors like unexpected tokens or missing delimiters + </div> + </dt> + <dd></dd> + <dt> + <dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type"><code>Error</code></span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + +</div> + + + +<div class="section-returns"> +<h5>Returns:</h5> + + + +<dl class="param-type"> + <dt> + Type: + </dt> + <dd> + +<span class="param-type"><code><a href="global.html#ASTNode">ASTNode</a></code></span> + + + </dd> +</dl> + + +<div class="param-desc"> + Abstract Syntax Tree with program body +</div> + + +</div> + + + +</div> + + +<div class="section-method"> + + + + <h4 class="name" id="readFile"><span class="type-signature">(async) </span>readFile<span class="signature">(filePath)</span><span class="type-signature"> → {Promise.<string>}</span></h4> + + + + + +<div class="description"> + Handles file reading across different platforms (Node.js, Bun, browser) +with appropriate fallbacks for each environment. This function is essential for +the language's file execution model where scripts are loaded from .txt files. + +The function prioritizes ES modules compatibility by using dynamic import, +but falls back to require for older Node.js versions. Browser environments +are not supported for file I/O operations. + +This cross-platform approach ensures the language can run in various JavaScript +environments while maintaining consistent behavior. The file reading capability +enables the language to execute scripts from files, supporting the development +workflow where tests and examples are stored as .txt files. +</div> + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lang.js.html">lang.js</a>, <a href="lang.js.html#line2853">line 2853</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>filePath</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last"> + Path to the file to read + + </td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + +<div class="section-throws"> +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc"> + For file reading errors + </div> + </dt> + <dd></dd> + <dt> + <dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type"><code>Error</code></span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + +</div> + + + +<div class="section-returns"> +<h5>Returns:</h5> + + + +<dl class="param-type"> + <dt> + Type: + </dt> + <dd> + +<span class="param-type"><code>Promise.<string></code></span> + + + </dd> +</dl> + + +<div class="param-desc"> + File contents as a string +</div> + + +</div> + + + +</div> + + +<div class="section-method"> + + + + <h4 class="name" id="run"><span class="type-signature"></span>run<span class="signature">(scriptContent, initialState<span class="signature-attributes">opt</span>, environment<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {*}</span></h4> + + + + + +<div class="description"> + Parses and executes a script using the combinator-based language. +This function orchestrates the entire execution pipeline from source code +to final result. + +The function performs the following steps: +1. Tokenize the source code using the lexer +2. Parse the tokens into an AST using the parser +3. Evaluate the AST using the interpreter +4. Return the final result + +This is the primary interface for executing scripts in the language. +It handles the parsing and evaluation pipeline, +providing a simple interface for users to run their code. + +The function supports both synchronous and asynchronous execution. When +the script contains IO operations that return Promises, the function +will return a Promise that resolves to the final result. This enables +non-blocking execution for interactive programs. + +Error handling is comprehensive, with errors from any stage of the +pipeline (lexing, parsing, or evaluation) being caught and re-thrown +with appropriate context. This ensures that users get meaningful +error messages that help them identify and fix issues in their code. + +The function is designed to be stateless, with each call creating +a fresh interpreter instance. This ensures that scripts don't interfere +with each other and enables safe concurrent execution of multiple scripts. +</div> + + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lang.js.html">lang.js</a>, <a href="lang.js.html#line2667">line 2667</a> + </li></ul></dd> + + + + + + + +</dl> + + + + + + + + + + <h5>Parameters:</h5> + + +<table class="params"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + <th>Default</th> + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>scriptContent</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + <td class="attributes"> + + + + + + </td> + + + + <td class="default"> + + </td> + + + <td class="description last"> + The script content to execute + + </td> + </tr> + + + + <tr> + + <td class="name"><code>initialState</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Object</code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + <td class="default"> + + {} + + </td> + + + <td class="description last"> + Initial state for the interpreter + + </td> + </tr> + + + + <tr> + + <td class="name"><code>environment</code></td> + + + <td class="type"> + + +<span class="param-type"><code><a href="global.html#Environment">Environment</a></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + + + </td> + + + + <td class="default"> + + null + + </td> + + + <td class="description last"> + Environment for IO operations + + </td> + </tr> + + + </tbody> +</table> + + + + + + + + + + + + +<div class="section-throws"> +<h5>Throws:</h5> + + + +<dl> + <dt> + <div class="param-desc"> + For parsing or evaluation errors + </div> + </dt> + <dd></dd> + <dt> + <dl> + <dt> + Type + </dt> + <dd> + +<span class="param-type"><code>Error</code></span> + + + </dd> + </dl> + </dt> + <dd></dd> +</dl> + + + +</div> + + + +<div class="section-returns"> +<h5>Returns:</h5> + + + +<dl class="param-type"> + <dt> + Type: + </dt> + <dd> + +<span class="param-type"><code>*</code></span> + + + </dd> +</dl> + + +<div class="param-desc"> + The result of executing the script +</div> + + +</div> + + + +</div> + + + + + <h3 class="subsection-title">Type Definitions</h3> + + + +<div class="section-members"> +<h4 class="name" id="ASTNode">ASTNode</h4> + + + + +<div class="description"> + AST node types for the language +</div> + + + + + + <h5 class="subsection-title">Properties:</h5> + + + +<table class="props"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>type</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + <td class="attributes"> + + + + </td> + + + + + <td class="description last">The node type identifier</td> + </tr> + + + + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type"><code>*</code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Node value (for literals)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>name</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Identifier name (for identifiers)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>body</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Array.<<a href="global.html#ASTNode">ASTNode</a>></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Program or function body</td> + </tr> + + + + + + <tr> + + <td class="name"><code>args</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Array.<<a href="global.html#ASTNode">ASTNode</a>></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Function call arguments</td> + </tr> + + + + + + <tr> + + <td class="name"><code>params</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Array.<string></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Function parameters</td> + </tr> + + + + + + <tr> + + <td class="name"><code>parameters</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Array.<string></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Function parameters (alternative)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>left</code></td> + + + <td class="type"> + + +<span class="param-type"><code><a href="global.html#ASTNode">ASTNode</a></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Left operand (for binary expressions)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>right</code></td> + + + <td class="type"> + + +<span class="param-type"><code><a href="global.html#ASTNode">ASTNode</a></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Right operand (for binary expressions)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>operand</code></td> + + + <td class="type"> + + +<span class="param-type"><code><a href="global.html#ASTNode">ASTNode</a></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Operand (for unary expressions)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>table</code></td> + + + <td class="type"> + + +<span class="param-type"><code><a href="global.html#ASTNode">ASTNode</a></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Table expression (for table access)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>key</code></td> + + + <td class="type"> + + +<span class="param-type"><code><a href="global.html#ASTNode">ASTNode</a></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Key expression (for table access)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>entries</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Array.<Object></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Table entries (for table literals)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>cases</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Array.<<a href="global.html#ASTNode">ASTNode</a>></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">When expression cases</td> + </tr> + + + + + + <tr> + + <td class="name"><code>pattern</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Array.<<a href="global.html#ASTNode">ASTNode</a>></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Pattern matching patterns</td> + </tr> + + + + + + <tr> + + <td class="name"><code>result</code></td> + + + <td class="type"> + + +<span class="param-type"><code>Array.<<a href="global.html#ASTNode">ASTNode</a>></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Pattern matching results</td> + </tr> + + + + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type"><code><a href="global.html#ASTNode">ASTNode</a></code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">When expression value</td> + </tr> + + + + + </tbody> +</table> + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line15">line 15</a> + </li></ul></dd> + + + + + + + +</dl> + + + + <h5>Type:</h5> + <ul> + <li> + +<span class="param-type"><code>Object</code></span> + + + </li> + </ul> + + + + + +</div> + + + +<div class="section-members"> +<h4 class="name" id="Environment">Environment</h4> + + + + +<div class="description"> + Environment interface for external system integration +</div> + + + + + + <h5 class="subsection-title">Properties:</h5> + + + +<table class="props"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>getCurrentState</code></td> + + + <td class="type"> + + +<span class="param-type"><code>function</code></span> + + + + </td> + + + + + + <td class="description last">Returns the current state from external system</td> + </tr> + + + + + + <tr> + + <td class="name"><code>emitValue</code></td> + + + <td class="type"> + + +<span class="param-type"><code>function</code></span> + + + + </td> + + + + + + <td class="description last">Sends a value to the external system</td> + </tr> + + + + + </tbody> +</table> + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lang.js.html">lang.js</a>, <a href="lang.js.html#line93">line 93</a> + </li></ul></dd> + + + + + + + +</dl> + + + + <h5>Type:</h5> + <ul> + <li> + +<span class="param-type"><code>Object</code></span> + + + </li> + </ul> + + + + + +</div> + + + +<div class="section-members"> +<h4 class="name" id="Token">Token</h4> + + + + +<div class="description"> + Token object structure +</div> + + + + + + <h5 class="subsection-title">Properties:</h5> + + + +<table class="props"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + <th>Attributes</th> + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>type</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + <td class="attributes"> + + + + </td> + + + + + <td class="description last">The token type from TokenType enum</td> + </tr> + + + + + + <tr> + + <td class="name"><code>value</code></td> + + + <td class="type"> + + +<span class="param-type"><code>*</code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">The token's value (for literals and identifiers)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>name</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + <td class="attributes"> + + <optional><br> + + + + </td> + + + + + <td class="description last">Function name (for FUNCTION_REF tokens)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>line</code></td> + + + <td class="type"> + + +<span class="param-type"><code>number</code></span> + + + + </td> + + + <td class="attributes"> + + + + </td> + + + + + <td class="description last">Line number where token appears (1-indexed)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>column</code></td> + + + <td class="type"> + + +<span class="param-type"><code>number</code></span> + + + + </td> + + + <td class="attributes"> + + + + </td> + + + + + <td class="description last">Column number where token appears (1-indexed)</td> + </tr> + + + + + </tbody> +</table> + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lexer.js.html">lexer.js</a>, <a href="lexer.js.html#line123">line 123</a> + </li></ul></dd> + + + + + + + +</dl> + + + + <h5>Type:</h5> + <ul> + <li> + +<span class="param-type"><code>Object</code></span> + + + </li> + </ul> + + + + + +</div> + + + +<div class="section-members"> +<h4 class="name" id="TokenType">TokenType</h4> + + + + +<div class="description"> + Defines all token types used by the lexer and parser. +Each token type represents a distinct syntactic element in the language. + +The token types are organized into categories: +- Literals: NUMBER, STRING, TRUE, FALSE +- Operators: PLUS, MINUS, MULTIPLY, DIVIDE, MODULO, POWER, etc. +- Keywords: WHEN, IS, THEN, FUNCTION, etc. +- Punctuation: LEFT_PAREN, RIGHT_PAREN, SEMICOLON, COMMA, etc. +- Special: IO_IN, IO_OUT, IO_ASSERT, IO_LISTEN, IO_EMIT, FUNCTION_REF, FUNCTION_ARG + +This enumeration provides a centralized definition of all possible +token types, ensuring consistency between lexer and parser. The token +types are designed to support the combinator-based architecture where +all operations are translated to function calls. +</div> + + + + + + <h5 class="subsection-title">Properties:</h5> + + + +<table class="props"> + <thead> + <tr> + + <th>Name</th> + + + <th>Type</th> + + + + + + <th class="last">Description</th> + </tr> + </thead> + + <tbody> + + + <tr> + + <td class="name"><code>NUMBER</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Numeric literals (integers and floats)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>PLUS</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Addition operator (+)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>MINUS</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Subtraction operator (-)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>MULTIPLY</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Multiplication operator (*)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>DIVIDE</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Division operator (/)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>IDENTIFIER</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Variable names and function names</td> + </tr> + + + + + + <tr> + + <td class="name"><code>ASSIGNMENT</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Assignment operator (:)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>ARROW</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Function arrow (->)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>CASE</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Case keyword</td> + </tr> + + + + + + <tr> + + <td class="name"><code>OF</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Of keyword</td> + </tr> + + + + + + <tr> + + <td class="name"><code>WHEN</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">When keyword for pattern matching</td> + </tr> + + + + + + <tr> + + <td class="name"><code>IS</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Is keyword for pattern matching</td> + </tr> + + + + + + <tr> + + <td class="name"><code>THEN</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Then keyword for pattern matching</td> + </tr> + + + + + + <tr> + + <td class="name"><code>WILDCARD</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Wildcard pattern (_)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>FUNCTION</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Function keyword</td> + </tr> + + + + + + <tr> + + <td class="name"><code>LEFT_PAREN</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Left parenthesis (()</td> + </tr> + + + + + + <tr> + + <td class="name"><code>RIGHT_PAREN</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Right parenthesis ())</td> + </tr> + + + + + + <tr> + + <td class="name"><code>LEFT_BRACE</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Left brace ({)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>RIGHT_BRACE</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Right brace (})</td> + </tr> + + + + + + <tr> + + <td class="name"><code>LEFT_BRACKET</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Left bracket ([)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>RIGHT_BRACKET</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Right bracket (])</td> + </tr> + + + + + + <tr> + + <td class="name"><code>SEMICOLON</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Semicolon (;)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>COMMA</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Comma (,)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>DOT</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Dot (.)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>STRING</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">String literals</td> + </tr> + + + + + + <tr> + + <td class="name"><code>TRUE</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Boolean true literal</td> + </tr> + + + + + + <tr> + + <td class="name"><code>FALSE</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Boolean false literal</td> + </tr> + + + + + + <tr> + + <td class="name"><code>AND</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Logical AND operator</td> + </tr> + + + + + + <tr> + + <td class="name"><code>OR</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Logical OR operator</td> + </tr> + + + + + + <tr> + + <td class="name"><code>XOR</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Logical XOR operator</td> + </tr> + + + + + + <tr> + + <td class="name"><code>NOT</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Logical NOT operator</td> + </tr> + + + + + + <tr> + + <td class="name"><code>EQUALS</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Equality operator (==)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>LESS_THAN</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Less than operator (<)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>GREATER_THAN</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Greater than operator (>)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>LESS_EQUAL</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Less than or equal operator (<=)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>GREATER_EQUAL</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Greater than or equal operator (>=)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>NOT_EQUAL</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Not equal operator (!=)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>MODULO</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Modulo operator (%)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>POWER</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Power operator (^)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>IO_IN</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Input operation (..in)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>IO_OUT</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Output operation (..out)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>IO_ASSERT</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Assertion operation (..assert)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>IO_LISTEN</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Listen operation (..listen)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>IO_EMIT</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Emit operation (..emit)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>FUNCTION_REF</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Function reference (@function)</td> + </tr> + + + + + + <tr> + + <td class="name"><code>FUNCTION_ARG</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Function argument (@(expression))</td> + </tr> + + + + + + <tr> + + <td class="name"><code>COMPOSE</code></td> + + + <td class="type"> + + +<span class="param-type"><code>string</code></span> + + + + </td> + + + + + + <td class="description last">Function composition (via)</td> + </tr> + + + + + </tbody> +</table> + + + + +<dl class="details"> + + + + + + + + + + + + + + + + + + + + + + + + + + + <dt class="tag-source">Source:</dt> + <dd class="tag-source"><ul class="dummy"><li> + <a href="lexer.js.html">lexer.js</a>, <a href="lexer.js.html#line4">line 4</a> + </li></ul></dd> + + + + + + + +</dl> + + + + <h5>Type:</h5> + <ul> + <li> + +<span class="param-type"><code>Object</code></span> + + + </li> + </ul> + + + + + +</div> + + + + + +</article> + +</section> + + + + +</div> + +<br class="clear"> + +<footer> + Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Tue Jul 29 2025 23:15:00 GMT-0400 (Eastern Daylight Time) using the Minami theme. +</footer> + +<script>prettyPrint();</script> +<script src="scripts/linenumber.js"></script> +</body> +</html> \ No newline at end of file |