mirror of
https://github.com/Noratrieb/brainfuck.git
synced 2026-01-15 22:05:02 +01:00
improve debugging
This commit is contained in:
parent
c3c24c73fe
commit
7973d9f77b
8 changed files with 189 additions and 32 deletions
|
|
@ -1,13 +1,14 @@
|
|||
use crate::parse::{Instr, Span};
|
||||
use crate::BumpVec;
|
||||
use bumpalo::Bump;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Ir<'ir> {
|
||||
pub stmts: BumpVec<'ir, Stmt<'ir>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Clone)]
|
||||
pub struct Stmt<'ir> {
|
||||
pub kind: StmtKind<'ir>,
|
||||
pub span: Span,
|
||||
|
|
@ -23,6 +24,12 @@ impl<'ir> Stmt<'ir> {
|
|||
}
|
||||
}
|
||||
|
||||
impl Debug for Stmt<'_> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_tuple("Stmt").field(&self.kind).finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum StmtKind<'ir> {
|
||||
Add(u8),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue