glados-0.1.0.0
Stabilitystable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Parser.Conditions

Description

This module defines parsers for control flow: - Conditional statements (if/else) - Iteration statements (while) Note: Parsers in this module often require pBlock and pVarDef as arguments to avoid circular dependencies with Parser.Statement.

Synopsis

Documentation

pIf :: Parser Ast -> Parser Ast -> Parser Ast Source #

Parse a full conditional statement: if, else if, else.

This function uses Dependency Injection for pVarDef and pBlock.

pWhile :: Parser Ast -> Parser Ast Source #

Parse a while loop.

Syntax: while (condition) { body } The body parsing relies on the injected pBlockParam.

pFor :: Parser Ast -> Parser Ast -> Parser Ast Source #

Parse a for loop.

Syntax: for (init; cond; update) { body } The condition is mandatory to prevent infinite loops by accident.