/* =====================================
 * Generated by Mod-c 0.26.5
 * HEADER expression MODULE
 * ===================================== */

#ifndef MODC_MODULE_expression_H
#define MODC_MODULE_expression_H

#include <stdint.h>
#include <stdbool.h>
#include <assert.h>

#define nil ((void *)0)
#define NIL nil
typedef uint8_t byte;
typedef const char* string;
typedef int integer;
typedef unsigned int cardinal;
typedef float real;

/**
 * Mod-c
 * By M. Scott Reynolds
 * Date 20 July 2026
 *
 * expression.mc - Expression parsing routines.
 */

/* === IMPORT === */
#include "parser_common.h"

/* === IMPORT === */
#include "parser_main.h"

/* === IMPORT === */
#include "arena.h"

/* === IMPORT === */
#include "ttype.h"

/* === IMPORT === */
#include "node.h"

/* === IMPORT === */
#include "Lexer.h"

/* === TYPE EXPORT === */
typedef Node* pNode;

/**
 * Parse conditional
 */

/* === PROC/FUNC EXPORT === */
Node* parse_conditional(pParser p);

/**
 * Parse logical OR
 */

/* === PROC/FUNC EXPORT === */
Node* parse_logical_or(pParser p);

/**
 * Parse logical AND
 */

/* === PROC/FUNC EXPORT === */
Node* parse_logical_and(pParser p);

/**
 * Parse equality
 */

/* === PROC/FUNC EXPORT === */
Node* parse_equality(pParser p);

/**
 * Parse relational
 */

/* === PROC/FUNC EXPORT === */
Node* parse_relational(pParser p);

/**
 * Parse shift
 */

/* === PROC/FUNC EXPORT === */
Node* parse_shift(pParser p);

/**
 * Parse additive
 */

/* === PROC/FUNC EXPORT === */
Node* parse_additive(pParser p);

/**
 * Parse multiplicative
 */

/* === PROC/FUNC EXPORT === */
Node* parse_multiplicative(pParser p);

/**
 * Parse Power
 */

/* === PROC/FUNC EXPORT === */
Node* parse_power(pParser p);

/**
 * True when SIZEOF '(' should parse a type-specifier, not a designator.
 */

/**
 * Parse SIZEOF expression
 * 	Grammar: "SIZEOF" "(" ( type-identifier | designator ) ")" 
 */

/* === PROC/FUNC EXPORT === */
pNode parse_sizeof(pParser p);

/**
 * Parse INC / DEC as either statement or expression.
 * When used in expressions, the code generator will add protective
 * parentheses around compound forms to preserve precedence.
 *
 * Grammar (expression form):
 * 		inc-dec-expr = "INC" "(" designator [ "," expression ] ")"
 * 					 | "DEC" "(" designator [ "," expression ] ")"
 */

/* === PROC/FUNC EXPORT === */
pNode parse_inc_dec_expr(pParser p);

/**
 * Parse unary
 */

/* === PROC/FUNC EXPORT === */
Node* parse_unary(pParser p);

/**
 * Parse cast expression
 * Grammar:
 * 	cast-expression = "CAST" "(" type-specifier "," expression ")"
 * 		| postfix-expression "AS" type-specifier 
 * 		| postfix-expression ;
 */

/* === PROC/FUNC EXPORT === */
Node* parse_cast(pParser p);

/**
 * Parse comma-separated argument list into an existing NODE_CALL.
 * Caller must have already consumed '('.
 */

/**
 * Parse postfix
 */

/* === PROC/FUNC EXPORT === */
pNode parse_postfix(pParser p);

/**
 * Parse primary
 */

/* === PROC/FUNC EXPORT === */
pNode parse_primary(pParser p);

/**
 * Parse call
 */

/* === PROC/FUNC EXPORT === */
pNode parse_call(pParser p, TToken ident_token);

/**
 * Parse array literal: "{" expression { "," expression } [ "," ] "}" 
 * Returns NODE_ARRAY_LITERAL node.
 * Exits on fatal error (unbalanced braces, etc.).
 */

/* === PROC/FUNC EXPORT === */
pNode parse_array_literal(pParser p);

/**
 * Parse array indexing: left [ index ]
 */

/* === PROC/FUNC EXPORT === */
pNode parse_array_index(pParser p, pNode left);

void expression(void);

#endif /* MODC_MODULE_expression_H */
