Skip to content

Language: User-defined constants (const, define()) and class constants #204

@PurHur

Description

@PurHur

Problem

Web apps use const VERSION = '1.0';, define('DEBUG', true);, and class constants for config. Support in CFG → opcodes → VM is incomplete or missing.

Goal

const APP_NAME = 'MiniWeb';
define('MAX_UPLOAD', 1024);
class Config { public const ENV = 'prod'; }

Tasks

  • Lower Op\Stmt\Const_ and define() calls
  • Class const in compileClassBody (extend beyond properties)
  • VM constant table + immutable fetches
  • JIT: inline literal constants where possible
  • PHPT compliance cases

Acceptance criteria

Echo constants from global and class scope in VM and JIT.

Dependencies

Files

  • lib/Compiler.php, lib/VM.php, lib/OpCode.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions