cas-compiler 0.2.0

Bytecode compiler for CalcScript programs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use cas_error::Error;
use cas_parser::parser::ast::range::Range;
use crate::{Compile, Compiler, InstructionKind};

impl Compile for Range {
    fn compile(&self, compiler: &mut Compiler) -> Result<(), Error> {
        self.start.compile(compiler)?;
        self.end.compile(compiler)?;
        compiler.add_instr(InstructionKind::CreateRange(self.kind));
        Ok(())
    }
}