Module codegen

Module codegen 

Source
Expand description

§Plurality Code Generation

Code generation for plurality constructs. Transforms plurality AST nodes into runtime Rust code that integrates with the DAEMONIORUM game engine.

§Generated Code Patterns

§Alter Definitions

// Generated from: alter Abaddon: Council { ... }
pub struct Abaddon {
    pub archetype: Archetype,
    pub preferred_reality: RealityLayer,
    pub abilities: Vec<Ability>,
    pub triggers: Vec<Trigger>,
    pub anima: AnimaState,
    pub state_machine: AlterStateMachine,
}

impl Alter for Abaddon {
    fn category(&self) -> AlterCategory { AlterCategory::Council }
    fn can_front(&self) -> bool { true }
    // ...
}

§Alter Blocks

// Generated from: alter Abaddon { ... }
{
    let _alter_guard = system.enter_alter::<Abaddon>();
    // ... block contents ...
} // AlterGuard drops, restores previous fronter

§Switch Expressions

// Generated from: switch to Beleth { ... }
system.propose_switch(SwitchRequest {
    target: AlterId::Beleth,
    reason: SwitchReason::Combat,
    urgency: 0.8,
    requires: Consensus::Majority,
}).then(|result| {
    // then block
}).otherwise(|result| {
    // else block
})

Structs§

PluralityCodeGen
Plurality code generator