This commit is contained in:
Janggun Lee
2025-01-06 18:45:28 +09:00
parent 021f2cd240
commit fcb6ca2538
15 changed files with 253 additions and 423 deletions

View File

@@ -17,7 +17,6 @@ use ordered_float::OrderedFloat;
use std::collections::{BTreeMap, HashMap};
use std::hash::{Hash, Hasher};
use crate::write_base::*;
pub use dtype::{Dtype, DtypeError, HasDtype};
pub use interp::{interp, Value};
pub use parse::Parse;
@@ -260,6 +259,16 @@ impl Instruction {
}
}
/// Format `lang_c::ast::{Binary,Unary}Operations` into KECC-IR.
///
/// Most cases, `fmt::Display` is used to format a type to a string. However, in some cases, we
/// can't implement `fmt::Display` for a type as it is defined in another crate. In such cases, we
/// can implement this trait to format the type to a string.
pub trait WriteOp {
/// Change operations into a String.
fn write_operation(&self) -> String;
}
impl WriteOp for ast::BinaryOperator {
fn write_operation(&self) -> String {
match self {