spliting compiler into backend and frontend

This commit is contained in:
2026-03-24 13:40:21 +00:00
parent 39eb8b2827
commit 51ecdeeb5c
25 changed files with 1219 additions and 2309 deletions
@@ -149,81 +149,4 @@ impl Syscall {
_ => None,
}
}
// pub fn as_str(&self) -> &'static str {
// match self {
// Self::SystemHasCart => "system.has_cart",
// Self::SystemRunCart => "system.run_cart",
// Self::GfxClear => "gfx.clear",
// Self::GfxFillRect => "gfx.fillRect",
// Self::GfxDrawLine => "gfx.drawLine",
// Self::GfxDrawCircle => "gfx.drawCircle",
// Self::GfxDrawDisc => "gfx.drawDisc",
// Self::GfxDrawSquare => "gfx.drawSquare",
// Self::InputGetPad => "input.get_pad",
// Self::InputGetPadPressed => "input.get_pad_pressed",
// Self::InputGetPadReleased => "input.get_pad_released",
// Self::InputGetPadHold => "input.get_pad_hold",
// Self::TouchGetX => "touch.getX",
// Self::TouchGetY => "touch.getY",
// Self::TouchIsDown => "touch.isDown",
// Self::TouchIsPressed => "touch.isPressed",
// Self::TouchIsReleased => "touch.isReleased",
// Self::TouchGetHold => "touch.getHold",
// Self::AudioPlaySample => "audio.playSample",
// Self::FsOpen => "fs.open",
// Self::FsRead => "fs.read",
// Self::FsWrite => "fs.write",
// Self::FsClose => "fs.close",
// Self::FsListDir => "fs.listDir",
// Self::FsExists => "fs.exists",
// Self::FsDelete => "fs.delete",
// Self::LogWrite => "log.write",
// Self::LogWriteTag => "log.writeTag",
// }
// }
pub fn from_name(name: &str) -> Option<Self> {
match name {
"system.hasCart" | "system.has_cart" => Some(Self::SystemHasCart),
"gfx.clear" => Some(Self::GfxClear),
"gfx.fillRect" | "gfx.draw_rect" => Some(Self::GfxFillRect),
"gfx.drawLine" | "gfx.draw_line" => Some(Self::GfxDrawLine),
"gfx.drawCircle" | "gfx.draw_circle" => Some(Self::GfxDrawCircle),
"gfx.drawDisc" | "gfx.draw_disc" => Some(Self::GfxDrawDisc),
"gfx.drawSquare" | "gfx.draw_square" => Some(Self::GfxDrawSquare),
"gfx.setSprite" | "gfx.set_sprite" => Some(Self::GfxSetSprite),
"gfx.drawText" | "gfx.draw_text" => Some(Self::GfxDrawText),
"input.getPad" => Some(Self::InputGetPad),
"input.getPadPressed" | "input.get_pad_pressed" => Some(Self::InputGetPadPressed),
"input.getPadReleased" | "input.get_pad_released" => Some(Self::InputGetPadReleased),
"input.getPadHold" | "input.get_pad_hold" => Some(Self::InputGetPadHold),
"touch.getX" | "touch.get_x" => Some(Self::TouchGetX),
"touch.getY" | "touch.get_y" => Some(Self::TouchGetY),
"touch.isDown" | "touch.is_down" => Some(Self::TouchIsDown),
"touch.isPressed" | "touch.is_pressed" => Some(Self::TouchIsPressed),
"touch.isReleased" | "touch.is_released" => Some(Self::TouchIsReleased),
"touch.getHold" | "touch.get_hold" => Some(Self::TouchGetHold),
"audio.playSample" | "audio.play_sample" => Some(Self::AudioPlaySample),
"audio.play" => Some(Self::AudioPlay),
"fs.open" => Some(Self::FsOpen),
"fs.read" => Some(Self::FsRead),
"fs.write" => Some(Self::FsWrite),
"fs.close" => Some(Self::FsClose),
"fs.listDir" | "fs.list_dir" => Some(Self::FsListDir),
"fs.exists" => Some(Self::FsExists),
"fs.delete" => Some(Self::FsDelete),
"log.write" => Some(Self::LogWrite),
"log.writeTag" | "log.write_tag" => Some(Self::LogWriteTag),
"asset.load" => Some(Self::AssetLoad),
"asset.status" => Some(Self::AssetStatus),
"asset.commit" => Some(Self::AssetCommit),
"asset.cancel" => Some(Self::AssetCancel),
"bank.info" => Some(Self::BankInfo),
"bank.slotInfo" | "bank.slot_info" => Some(Self::BankSlotInfo),
_ => {
None
}
}
}
}