Module quark.scripting.parser

@file parser.d

Recursive descent parser for QScript scripting language.

This module provides syntax analysis for QScript (.qscr) files, converting a stream of tokens from the lexer into an Abstract Syntax Tree (AST). The parser implements a recursive descent algorithm following the QScript grammar, providing detailed error messages with location information.

Classes

NameDescription
AssignmentStatement Assignment statement (e.g., x = 42;).
ASTNode Base class for all AST nodes.
BinaryExpression Binary operation expression (e.g., a + b, x == y).
BlockStatement Block statement (e.g., { var x = 1; print(x); }).
Expression Base class for all expression nodes.
ExpressionStatement Expression statement (e.g., functionCall();).
ForStatement For loop statement (e.g., for (var i = 0; i < 10; i = i + 1) { ... }).
FunctionCallExpression Function call expression (e.g., add(1, 2)).
FunctionDefStatement Function definition statement (e.g., func add(a, b) { return a + b; }).
IdentifierExpression Identifier expression (e.g., variableName).
IfStatement If statement (e.g., if (x > 0) { ... } else { ... }).
LiteralExpression Literal value expression (e.g., 42, "hello", true).
Parser Recursive descent parser for QScript.
Program Program node (root of the AST).
ReturnStatement Return statement (e.g., return x + 1;).
Statement Base class for all statement nodes.
UnaryExpression Unary operation expression (e.g., -x, !flag).
VarDeclStatement Variable declaration statement (e.g., var x = 10;).
WhileStatement While loop statement (e.g., while (x < 10) { ... }).