Move to a much more "simple" parser, start op impl

- wasm compiles in seconds instead of 20+ minutes wooo! (I'm looking at
  you rust-sitter)

Signed-off-by: Rachel <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel
2024-03-24 23:11:08 -07:00
parent da03005bae
commit 93b5a7c4bf
16 changed files with 1555 additions and 3529 deletions

View File

@@ -6,13 +6,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Increase Swap
uses: get-bridge/swap-space-action@v1
with:
swap-size-mb: 16384
- name: Report Disk
run: |
df -h
# - name: Increase Swap
# uses: get-bridge/swap-space-action@v1
# with:
# swap-size-mb: 16384
# - name: Report Disk
# run: |
# df -h
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm

1093
ic10emu/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -11,15 +11,17 @@ crate-type = ["lib"]
[dependencies]
const-crc32 = "1.3.0"
itertools = "0.12.1"
phf = "0.11.2"
regex = "1.10.3"
rust-sitter = "0.4.1"
# rust-sitter = "0.4.1"
strum_macros = "0.26.2"
thiserror = "1.0.58"
[build-dependencies]
convert_case = "0.6.0"
phf_codegen = "0.11.2"
regex = "1.10.3"
rust-sitter-tool = "0.4.1"
# rust-sitter-tool = "0.4.1"

View File

@@ -26,7 +26,7 @@ fn write_logictypes(logictypes_grammar: &mut HashSet<String>) {
logictypes_grammar.insert(name.to_string());
if let Some(v) = val {
logictype_lookup_map_builder.entry(name.to_case(Case::Pascal), &format!("{}u8", v));
logictype_lookup_map_builder.entry(name, &format!("{}u8", v));
}
}
@@ -42,7 +42,7 @@ fn write_logictypes(logictypes_grammar: &mut HashSet<String>) {
logictypes_grammar.insert(name.to_string());
if let Some(v) = val {
slotlogictype_lookup_map_builder.entry(name.to_case(Case::Pascal), &format!("{}u8", v));
slotlogictype_lookup_map_builder.entry(name, &format!("{}u8", v));
}
}
@@ -52,10 +52,8 @@ fn write_logictypes(logictypes_grammar: &mut HashSet<String>) {
logictype_lookup_map_builder.build()
)
.unwrap();
println!("cargo:rerun-if-changed=data/logictypes.txt");
write!(
&mut writer,
"pub(crate) const SLOT_TYPE_LOOKUP: phf::Map<&'static str, u8> = {};\n",
@@ -90,7 +88,7 @@ fn write_enums(enums_grammar: &mut HashSet<String>) {
}
if let Some(v) = val {
enums_lookup_map_builder.entry(name.to_case(Case::Pascal), &format!("{}u8", v));
enums_lookup_map_builder.entry(name, &format!("{}u8", v));
}
}
@@ -123,7 +121,7 @@ fn write_modes(logictypes_grammar: &mut HashSet<String>) {
logictypes_grammar.insert(name.to_string());
if let Some(v) = val {
batchmode_lookup_map_builder.entry(name.to_case(Case::Pascal), &format!("{}u8", v));
batchmode_lookup_map_builder.entry(name, &format!("{}u8", v));
}
}
@@ -139,7 +137,7 @@ fn write_modes(logictypes_grammar: &mut HashSet<String>) {
logictypes_grammar.insert(name.to_string());
if let Some(v) = val {
reagentmode_lookup_map_builder.entry(name.to_case(Case::Pascal), &format!("{}u8", v));
reagentmode_lookup_map_builder.entry(name, &format!("{}u8", v));
}
}
@@ -179,7 +177,7 @@ fn write_constants(constants_grammar: &mut HashSet<String>) {
let constant = it.next().unwrap();
constants_grammar.insert(name.to_string());
constants_lookup_map_builder.entry(name.to_case(Case::Pascal), constant);
constants_lookup_map_builder.entry(name, constant);
}
write!(
@@ -191,82 +189,13 @@ fn write_constants(constants_grammar: &mut HashSet<String>) {
println!("cargo:rerun-if-changed=data/constants.txt");
}
fn write_logictypes_grammar(logictypes: &HashSet<String>) {
let dest_path = Path::new("src/grammar/ic10").join("logictypes.rs");
fn write_instructions_enum() {
let out_dir = env::var_os("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("instructions.rs");
let output_file = File::create(dest_path).unwrap();
let mut writer = BufWriter::new(&output_file);
write!(
&mut writer,
"// GENERATED CODE DO NOT MODIFY\n\
#[derive(PartialEq, Debug, IntoStaticStr, AsRefStr)]\n\
pub enum LogicType {{\n\
"
)
.unwrap();
for typ in logictypes {
let enum_name = typ.to_case(Case::Pascal);
write!(
&mut writer,
" #[rust_sitter::leaf(text = \"{typ}\" )]{},\n",
&enum_name
)
.unwrap();
}
write!(&mut writer, "}}\n").unwrap();
}
fn write_enums_grammar(enums: &HashSet<String>) {
let dest_path = Path::new("src/grammar/ic10").join("enums.rs");
let output_file = File::create(dest_path).unwrap();
let mut writer = BufWriter::new(&output_file);
write!(
&mut writer,
"// GENERATED CODE DO NOT MODIFY\n\
#[derive(PartialEq, Debug, IntoStaticStr, AsRefStr)]\n\
pub enum Enum {{\n\
"
)
.unwrap();
for typ in enums {
let enum_name = typ.replace(".", "").to_case(Case::Pascal);
write!(
&mut writer,
" #[rust_sitter::leaf(text = \"{typ}\" )]{},\n",
&enum_name
)
.unwrap();
}
write!(&mut writer, "}}\n").unwrap();
}
fn write_constants_grammar(constants: HashSet<String>) {
let dest_path = Path::new("src/grammar/ic10").join("constants.rs");
let output_file = File::create(dest_path).unwrap();
let mut writer = BufWriter::new(&output_file);
write!(
&mut writer,
"// GENERATED CODE DO NOT MODIFY\n\
#[derive(PartialEq, Debug, IntoStaticStr, AsRefStr)]\n\
pub enum Constant {{\n\
"
)
.unwrap();
for typ in constants {
let enum_name = typ.replace(".", "").to_case(Case::Pascal);
write!(
&mut writer,
" #[rust_sitter::leaf(text = \"{typ}\" )]{},\n",
&enum_name
)
.unwrap();
}
write!(&mut writer, "}}\n").unwrap();
}
fn load_instructions() -> HashSet<String> {
let mut instructions = HashSet::new();
let infile = Path::new("data/instructions.txt");
let contents = fs::read_to_string(infile).unwrap();
@@ -276,104 +205,6 @@ fn load_instructions() -> HashSet<String> {
let instruction = it.next().unwrap();
instructions.insert(instruction.to_string());
}
instructions
}
fn write_instructions_grammar(instructions: &HashSet<String>) {
let dest_path = Path::new("src/grammar/ic10").join("instructions.rs");
let output_file = File::create(dest_path).unwrap();
let mut writer = BufWriter::new(&output_file);
write!(
&mut writer,
"// GENERATED CODE DO NOT MODIFY\n\
#[derive(PartialEq, Debug, IntoStaticStr, AsRefStr)]\n\
pub enum InstructionOp {{\n\
"
)
.unwrap();
for typ in instructions {
let enum_name = typ.to_case(Case::Pascal);
write!(
&mut writer,
" #[rust_sitter::leaf(text = \"{typ}\" )]{},\n",
&enum_name
)
.unwrap();
}
write!(&mut writer, "}}\n").unwrap();
}
fn patch_grammar() {
let out_path = env::var_os("OUT_DIR").unwrap();
let out_dir = Path::new(&out_path);
let src_dir = Path::new("src");
fs::copy(
src_dir.join("grammar.rs"),
out_dir.join("grammar_unpatched.rs"),
)
.unwrap();
{
let grammar_file = File::open(src_dir.join("grammar.rs")).unwrap();
let output_file = File::create(out_dir.join("grammar_patched.rs")).unwrap();
let mut writer = BufWriter::new(output_file);
let patch_regex = regex::Regex::new(r"^\s+// PATCH ([\w/.]+)\s*$").unwrap();
let mut patch_marker: Option<regex::Regex> = None;
for line in BufReader::new(grammar_file).lines().flatten() {
if let Some(marker) = &patch_marker {
if let Some(_) = marker.captures(&line) {
write!(&mut writer, "{}\n", line).unwrap();
patch_marker = None;
} else {
continue;
}
} else {
if let Some(captures) = patch_regex.captures(&line) {
write!(&mut writer, "{}\n", line).unwrap();
let in_path = captures.get(1).unwrap();
patch_marker = Some(
regex::Regex::new(&format!(r"^\s+// END PATCH {}\s*$", in_path.as_str()))
.unwrap(),
);
let in_buff =
BufReader::new(File::open(src_dir.join(in_path.as_str())).unwrap());
write!(
&mut writer,
" {}\n",
in_buff.lines().flatten().collect::<Vec<_>>().join("\n ")
)
.unwrap();
} else {
write!(&mut writer, "{}\n", line).unwrap();
}
}
}
}
fs::rename(
out_dir.join("grammar_patched.rs"),
src_dir.join("grammar.rs"),
)
.unwrap();
}
fn build_grammar() {
println!("cargo:rerun-if-changed=src/grammar/");
println!("cargo:rerun-if-changed=src/grammar.rs");
// let out_path = env::var_os("OUT_DIR").unwrap();
// let out_dir = Path::new(&out_path);
rust_sitter_tool::build_parsers(&PathBuf::from("src/lib.rs"));
// rust_sitter_tool::build_parsers(&out_dir.join("grammar_patched.rs"));
}
fn write_instructions_enum(instructions: &HashSet<String>) {
let out_dir = env::var_os("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("instructions.rs");
let output_file = File::create(dest_path).unwrap();
let mut writer = BufWriter::new(&output_file);
write!(
&mut writer,
@@ -385,34 +216,35 @@ fn write_instructions_enum(instructions: &HashSet<String>) {
write!(&mut writer, " Nop,\n").unwrap();
for typ in instructions {
for typ in &instructions {
write!(&mut writer, " {},\n", typ.to_case(Case::Pascal)).unwrap();
}
write!(&mut writer, "}}\n").unwrap();
write!(
&mut writer,
"impl From<crate::grammar::ic10::InstructionOp> for InstructionOp {{\n \
fn from(value: crate::grammar::ic10::InstructionOp) -> Self {{\n \
match value {{\n"
"impl FromStr for InstructionOp {{\n \
type Err = ParseError;\n \
fn from_str(s: &str) -> Result<Self, Self::Err> {{\n \
let end = s.len();\n \
match s {{\n"
)
.unwrap();
for typ in instructions {
for typ in &instructions {
let name = typ.to_case(Case::Pascal);
write!(
&mut writer,
" crate::grammar::ic10::InstructionOp::{name} => Self::{name},\n"
)
.unwrap();
write!(&mut writer, " \"{typ}\" => Ok(Self::{name}),\n").unwrap();
}
write!(
&mut writer,
" }}\n \
" _ => Err(crate::grammar::ParseError {{ line: 0, start: 0, end, msg: format!(\"Unknown instruction '{{}}'\", s) }})\n \
}}\n \
}}\n\
}}"
)
.unwrap();
println!("cargo:rerun-if-changed=data/instructions.txt");
}
fn main() {
@@ -425,15 +257,5 @@ fn main() {
write_constants(&mut constants_grammar);
write_enums(&mut enums_grammar);
let instructions = load_instructions();
write_instructions_enum(&instructions);
write_logictypes_grammar(&logictype_grammar);
write_enums_grammar(&enums_grammar);
write_constants_grammar(constants_grammar);
write_instructions_grammar(&instructions);
patch_grammar();
build_grammar();
write_instructions_enum();
}

View File

@@ -1,115 +0,0 @@
use std::convert::AsRef;
use crate::grammar;
// include files built from lang def
include!(concat!(env!("OUT_DIR"), "/logictypes.rs"));
include!(concat!(env!("OUT_DIR"), "/modes.rs"));
include!(concat!(env!("OUT_DIR"), "/constants.rs"));
include!(concat!(env!("OUT_DIR"), "/enums.rs"));
include!(concat!(env!("OUT_DIR"), "/instructions.rs"));
#[derive(Debug)]
pub enum Device {
Db,
Numbered(u8),
Indirect { indirection: u32, target: u8 },
}
impl From<grammar::rich_types::Device> for Device {
fn from(value: grammar::rich_types::Device) -> Self {
match value {
grammar::rich_types::Device::Db => Self::Db,
grammar::rich_types::Device::Numbered(n) => Self::Numbered(n),
grammar::rich_types::Device::Indirect(r) => Self::Indirect {
indirection: r.indirection,
target: r.target,
},
}
}
}
#[derive(Debug)]
pub enum Operand {
Register {
indirection: u32,
target: u8,
},
DeviceSpec {
device: Device,
channel: Option<u32>,
},
Number(f64),
Identifier(String),
}
impl TryFrom<grammar::ic10::Operand> for Operand {
type Error = String;
fn try_from(value: grammar::ic10::Operand) -> Result<Self, Self::Error> {
match value {
grammar::ic10::Operand::RegisterSpec(r) => Ok(Self::Register {
indirection: r.indirection,
target: r.target,
}),
grammar::ic10::Operand::DeviceSpec(ds) => Ok(Self::DeviceSpec {
device: ds.device.into(),
channel: ds.channel,
}),
grammar::ic10::Operand::LogicType(t) => Ok(Self::Number(
(*LOGIC_TYPE_LOOKUP
.get(t.as_ref())
.ok_or(format!("Unknown Logic Type {}", t.as_ref()))?)
.into(),
)),
grammar::ic10::Operand::Identifier(id) => Ok(Self::Identifier(id.name)),
grammar::ic10::Operand::Number(n) => match n {
grammar::ic10::Number::Float(f) => Ok(Self::Number(f)),
grammar::ic10::Number::Binary(_, f) => Ok(Self::Number(f)),
grammar::ic10::Number::Hexadecimal(_, f) => Ok(Self::Number(f)),
grammar::ic10::Number::Constant(c) => Ok(Self::Number(
*CONSTANTS_LOOKUP
.get(c.as_ref())
.ok_or(format!("Unknown constant {}", c.as_ref()))?,
)),
grammar::ic10::Number::Enum(e) => Ok(Self::Number(
(*ENUM_LOOKUP
.get(e.as_ref())
.ok_or(format!("Unknown enum {}", e.as_ref()))?)
.into(),
)),
grammar::ic10::Number::String(s) => Ok(Self::Number(s.string.hash.into())),
},
}
}
}
#[derive(Debug)]
pub struct Instruction {
pub instruction: InstructionOp,
pub operands: Vec<Operand>,
}
#[derive(Debug)]
pub struct Program {
pub instructions: Vec<Instruction>,
}
impl Default for Program {
fn default() -> Self {
Program::new()
}
}
impl Program {
pub fn new() -> Self { Program { instructions: Vec::new() }}
pub fn try_from_code(input: &str) -> Result<Self, String> {
let mut code = input.to_string();
if let Some((i, _)) = code.char_indices().rev().nth(0) {
let last_char = &code[i..];
if last_char != "\r" && last_char != "\n" {code.push('\n');}
}
let parse_tree = grammar::ic10::parse(&code);
Ok(Program { instructions: vec![] })
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +0,0 @@
// GENERATED CODE DO NOT MODIFY
#[derive(PartialEq, Debug, IntoStaticStr, AsRefStr)]
pub enum Constant {
#[rust_sitter::leaf(text = "pi" )]Pi,
#[rust_sitter::leaf(text = "nan" )]Nan,
#[rust_sitter::leaf(text = "pinf" )]Pinf,
#[rust_sitter::leaf(text = "epsilon" )]Epsilon,
#[rust_sitter::leaf(text = "deg2rad" )]Deg2Rad,
#[rust_sitter::leaf(text = "rad2deg" )]Rad2Deg,
#[rust_sitter::leaf(text = "ninf" )]Ninf,
}

View File

@@ -1,368 +0,0 @@
// GENERATED CODE DO NOT MODIFY
#[derive(PartialEq, Debug, IntoStaticStr, AsRefStr)]
pub enum Enum {
#[rust_sitter::leaf(text = "LogicType.PowerGeneration" )]LogicTypePowerGeneration,
#[rust_sitter::leaf(text = "SlotClass.Bottle" )]SlotClassBottle,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidOxygenOutput2" )]LogicTypeRatioLiquidOxygenOutput2,
#[rust_sitter::leaf(text = "Color.Gray" )]ColorGray,
#[rust_sitter::leaf(text = "LogicSlotType.OccupantHash" )]LogicSlotTypeOccupantHash,
#[rust_sitter::leaf(text = "LogicType.RatioCarbonDioxideInput" )]LogicTypeRatioCarbonDioxideInput,
#[rust_sitter::leaf(text = "LogicType.RatioPollutantOutput2" )]LogicTypeRatioPollutantOutput2,
#[rust_sitter::leaf(text = "SlotClass.Circuit" )]SlotClassCircuit,
#[rust_sitter::leaf(text = "LogicType.PositionZ" )]LogicTypePositionZ,
#[rust_sitter::leaf(text = "LogicType.PressureInternal" )]LogicTypePressureInternal,
#[rust_sitter::leaf(text = "RobotMode.None" )]RobotModeNone,
#[rust_sitter::leaf(text = "LogicType.TemperatureExternal" )]LogicTypeTemperatureExternal,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidNitrogenInput2" )]LogicTypeRatioLiquidNitrogenInput2,
#[rust_sitter::leaf(text = "LogicType.DestinationCode" )]LogicTypeDestinationCode,
#[rust_sitter::leaf(text = "LogicType.SizeX" )]LogicTypeSizeX,
#[rust_sitter::leaf(text = "SlotClass.Helmet" )]SlotClassHelmet,
#[rust_sitter::leaf(text = "SlotClass.Motherboard" )]SlotClassMotherboard,
#[rust_sitter::leaf(text = "Equals" )]Equals,
#[rust_sitter::leaf(text = "LogicType.HorizontalRatio" )]LogicTypeHorizontalRatio,
#[rust_sitter::leaf(text = "LogicType.Open" )]LogicTypeOpen,
#[rust_sitter::leaf(text = "LogicType.SettingOutput" )]LogicTypeSettingOutput,
#[rust_sitter::leaf(text = "LogicType.ElevatorSpeed" )]LogicTypeElevatorSpeed,
#[rust_sitter::leaf(text = "LogicType.ManualResearchRequiredPod" )]LogicTypeManualResearchRequiredPod,
#[rust_sitter::leaf(text = "LogicType.PressureInput" )]LogicTypePressureInput,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidCarbonDioxideOutput" )]LogicTypeRatioLiquidCarbonDioxideOutput,
#[rust_sitter::leaf(text = "LogicType.Mass" )]LogicTypeMass,
#[rust_sitter::leaf(text = "LogicType.MineablesInVicinity" )]LogicTypeMineablesInVicinity,
#[rust_sitter::leaf(text = "AirCon.Cold" )]AirConCold,
#[rust_sitter::leaf(text = "EntityState.Alive" )]EntityStateAlive,
#[rust_sitter::leaf(text = "LogicType.RatioWater" )]LogicTypeRatioWater,
#[rust_sitter::leaf(text = "LogicType.Channel3" )]LogicTypeChannel3,
#[rust_sitter::leaf(text = "LogicType.Filtration" )]LogicTypeFiltration,
#[rust_sitter::leaf(text = "LogicSlotType.Mature" )]LogicSlotTypeMature,
#[rust_sitter::leaf(text = "LogicType.VolumeOfLiquid" )]LogicTypeVolumeOfLiquid,
#[rust_sitter::leaf(text = "LogicType.Plant" )]LogicTypePlant,
#[rust_sitter::leaf(text = "LogicSlotType.On" )]LogicSlotTypeOn,
#[rust_sitter::leaf(text = "SlotClass.GasFilter" )]SlotClassGasFilter,
#[rust_sitter::leaf(text = "SlotClass.DataDisk" )]SlotClassDataDisk,
#[rust_sitter::leaf(text = "GasType.Volatiles" )]GasTypeVolatiles,
#[rust_sitter::leaf(text = "AirControl.Draught" )]AirControlDraught,
#[rust_sitter::leaf(text = "LogicType.Temperature" )]LogicTypeTemperature,
#[rust_sitter::leaf(text = "GasType.Pollutant" )]GasTypePollutant,
#[rust_sitter::leaf(text = "GasType.NitrousOxide" )]GasTypeNitrousOxide,
#[rust_sitter::leaf(text = "LogicSlotType.Health" )]LogicSlotTypeHealth,
#[rust_sitter::leaf(text = "LogicType.RatioNitrousOxideOutput" )]LogicTypeRatioNitrousOxideOutput,
#[rust_sitter::leaf(text = "SortingClass.Tools" )]SortingClassTools,
#[rust_sitter::leaf(text = "LogicType.ImportCount" )]LogicTypeImportCount,
#[rust_sitter::leaf(text = "LogicType.ThrustToWeight" )]LogicTypeThrustToWeight,
#[rust_sitter::leaf(text = "LogicSlotType.Quantity" )]LogicSlotTypeQuantity,
#[rust_sitter::leaf(text = "LogicType.CelestialParentHash" )]LogicTypeCelestialParentHash,
#[rust_sitter::leaf(text = "LogicType.RatioSteamInput2" )]LogicTypeRatioSteamInput2,
#[rust_sitter::leaf(text = "SlotClass.Belt" )]SlotClassBelt,
#[rust_sitter::leaf(text = "LogicType.ElevatorLevel" )]LogicTypeElevatorLevel,
#[rust_sitter::leaf(text = "SlotClass.Wreckage" )]SlotClassWreckage,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidVolatiles" )]LogicTypeRatioLiquidVolatiles,
#[rust_sitter::leaf(text = "SlotClass.Organ" )]SlotClassOrgan,
#[rust_sitter::leaf(text = "SlotClass.Tool" )]SlotClassTool,
#[rust_sitter::leaf(text = "LogicType.CombustionInput" )]LogicTypeCombustionInput,
#[rust_sitter::leaf(text = "LogicSlotType.None" )]LogicSlotTypeNone,
#[rust_sitter::leaf(text = "LogicType.PositionX" )]LogicTypePositionX,
#[rust_sitter::leaf(text = "LogicType.RatioCarbonDioxideInput2" )]LogicTypeRatioCarbonDioxideInput2,
#[rust_sitter::leaf(text = "LogicType.RatioNitrogenOutput2" )]LogicTypeRatioNitrogenOutput2,
#[rust_sitter::leaf(text = "LogicSlotType.ReferenceId" )]LogicSlotTypeReferenceId,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidNitrogenOutput" )]LogicTypeRatioLiquidNitrogenOutput,
#[rust_sitter::leaf(text = "LogicType.RatioWaterInput" )]LogicTypeRatioWaterInput,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidVolatilesInput2" )]LogicTypeRatioLiquidVolatilesInput2,
#[rust_sitter::leaf(text = "LogicType.TimeToDestination" )]LogicTypeTimeToDestination,
#[rust_sitter::leaf(text = "SlotClass.LiquidCanister" )]SlotClassLiquidCanister,
#[rust_sitter::leaf(text = "SlotClass.Blocked" )]SlotClassBlocked,
#[rust_sitter::leaf(text = "GasType.Undefined" )]GasTypeUndefined,
#[rust_sitter::leaf(text = "AirControl.Offline" )]AirControlOffline,
#[rust_sitter::leaf(text = "LogicType.WattsReachingContact" )]LogicTypeWattsReachingContact,
#[rust_sitter::leaf(text = "LogicSlotType.Growth" )]LogicSlotTypeGrowth,
#[rust_sitter::leaf(text = "DaylightSensorMode.Horizontal" )]DaylightSensorModeHorizontal,
#[rust_sitter::leaf(text = "LogicType.SoundAlert" )]LogicTypeSoundAlert,
#[rust_sitter::leaf(text = "RobotMode.StorageFull" )]RobotModeStorageFull,
#[rust_sitter::leaf(text = "Color.Brown" )]ColorBrown,
#[rust_sitter::leaf(text = "LogicType.Time" )]LogicTypeTime,
#[rust_sitter::leaf(text = "LogicType.TotalMolesInput2" )]LogicTypeTotalMolesInput2,
#[rust_sitter::leaf(text = "LogicType.RatioOxygenOutput" )]LogicTypeRatioOxygenOutput,
#[rust_sitter::leaf(text = "LogicSlotType.LineNumber" )]LogicSlotTypeLineNumber,
#[rust_sitter::leaf(text = "SlotClass.Uniform" )]SlotClassUniform,
#[rust_sitter::leaf(text = "ElevatorMode.Upward" )]ElevatorModeUpward,
#[rust_sitter::leaf(text = "LogicType.RatioWaterOutput" )]LogicTypeRatioWaterOutput,
#[rust_sitter::leaf(text = "LogicType.Maximum" )]LogicTypeMaximum,
#[rust_sitter::leaf(text = "LogicType.AutoShutOff" )]LogicTypeAutoShutOff,
#[rust_sitter::leaf(text = "LogicType.AlignmentError" )]LogicTypeAlignmentError,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidOxygen" )]LogicTypeRatioLiquidOxygen,
#[rust_sitter::leaf(text = "LogicType.Channel7" )]LogicTypeChannel7,
#[rust_sitter::leaf(text = "LogicType.PressureSetting" )]LogicTypePressureSetting,
#[rust_sitter::leaf(text = "LogicSlotType.Temperature" )]LogicSlotTypeTemperature,
#[rust_sitter::leaf(text = "LogicType.EntityState" )]LogicTypeEntityState,
#[rust_sitter::leaf(text = "SlotClass.Plant" )]SlotClassPlant,
#[rust_sitter::leaf(text = "LogicType.TargetPadIndex" )]LogicTypeTargetPadIndex,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidNitrogenInput" )]LogicTypeRatioLiquidNitrogenInput,
#[rust_sitter::leaf(text = "LogicType.SignalID" )]LogicTypeSignalId,
#[rust_sitter::leaf(text = "GasType.LiquidVolatiles" )]GasTypeLiquidVolatiles,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidOxygenInput" )]LogicTypeRatioLiquidOxygenInput,
#[rust_sitter::leaf(text = "LogicType.RatioVolatilesOutput2" )]LogicTypeRatioVolatilesOutput2,
#[rust_sitter::leaf(text = "LogicType.TemperatureOutput2" )]LogicTypeTemperatureOutput2,
#[rust_sitter::leaf(text = "LogicType.VelocityRelativeX" )]LogicTypeVelocityRelativeX,
#[rust_sitter::leaf(text = "AirCon.Hot" )]AirConHot,
#[rust_sitter::leaf(text = "LogicType.Flush" )]LogicTypeFlush,
#[rust_sitter::leaf(text = "AirControl.None" )]AirControlNone,
#[rust_sitter::leaf(text = "SlotClass.Egg" )]SlotClassEgg,
#[rust_sitter::leaf(text = "SlotClass.Glasses" )]SlotClassGlasses,
#[rust_sitter::leaf(text = "LogicType.On" )]LogicTypeOn,
#[rust_sitter::leaf(text = "LogicSlotType.ChargeRatio" )]LogicSlotTypeChargeRatio,
#[rust_sitter::leaf(text = "Color.Purple" )]ColorPurple,
#[rust_sitter::leaf(text = "LogicType.VelocityRelativeY" )]LogicTypeVelocityRelativeY,
#[rust_sitter::leaf(text = "LogicType.RatioOxygenInput2" )]LogicTypeRatioOxygenInput2,
#[rust_sitter::leaf(text = "LogicType.RatioNitrousOxideInput2" )]LogicTypeRatioNitrousOxideInput2,
#[rust_sitter::leaf(text = "SlotClass.Torpedo" )]SlotClassTorpedo,
#[rust_sitter::leaf(text = "LogicType.Orientation" )]LogicTypeOrientation,
#[rust_sitter::leaf(text = "LogicSlotType.MaxQuantity" )]LogicSlotTypeMaxQuantity,
#[rust_sitter::leaf(text = "GasType.Oxygen" )]GasTypeOxygen,
#[rust_sitter::leaf(text = "GasType.CarbonDioxide" )]GasTypeCarbonDioxide,
#[rust_sitter::leaf(text = "LogicType.PressureEfficiency" )]LogicTypePressureEfficiency,
#[rust_sitter::leaf(text = "SlotClass.Ore" )]SlotClassOre,
#[rust_sitter::leaf(text = "LogicType.RatioNitrousOxide" )]LogicTypeRatioNitrousOxide,
#[rust_sitter::leaf(text = "LogicType.ClearMemory" )]LogicTypeClearMemory,
#[rust_sitter::leaf(text = "LogicType.ForwardZ" )]LogicTypeForwardZ,
#[rust_sitter::leaf(text = "LogicSlotType.Class" )]LogicSlotTypeClass,
#[rust_sitter::leaf(text = "LogicType.TotalMoles" )]LogicTypeTotalMoles,
#[rust_sitter::leaf(text = "SlotClass.Magazine" )]SlotClassMagazine,
#[rust_sitter::leaf(text = "SlotClass.SoundCartridge" )]SlotClassSoundCartridge,
#[rust_sitter::leaf(text = "LogicType.CurrentResearchPodType" )]LogicTypeCurrentResearchPodType,
#[rust_sitter::leaf(text = "LogicType.Reagents" )]LogicTypeReagents,
#[rust_sitter::leaf(text = "LogicType.PowerRequired" )]LogicTypePowerRequired,
#[rust_sitter::leaf(text = "Color.Yellow" )]ColorYellow,
#[rust_sitter::leaf(text = "Vent.Inward" )]VentInward,
#[rust_sitter::leaf(text = "LogicType.RatioCarbonDioxide" )]LogicTypeRatioCarbonDioxide,
#[rust_sitter::leaf(text = "LogicType.RecipeHash" )]LogicTypeRecipeHash,
#[rust_sitter::leaf(text = "LogicType.InterrogationProgress" )]LogicTypeInterrogationProgress,
#[rust_sitter::leaf(text = "LogicType.RatioNitrogenOutput" )]LogicTypeRatioNitrogenOutput,
#[rust_sitter::leaf(text = "LogicType.MineablesInQueue" )]LogicTypeMineablesInQueue,
#[rust_sitter::leaf(text = "SlotClass.Ingot" )]SlotClassIngot,
#[rust_sitter::leaf(text = "SlotClass.CreditCard" )]SlotClassCreditCard,
#[rust_sitter::leaf(text = "LogicType.VelocityX" )]LogicTypeVelocityX,
#[rust_sitter::leaf(text = "LogicType.ExhaustVelocity" )]LogicTypeExhaustVelocity,
#[rust_sitter::leaf(text = "LogicType.Power" )]LogicTypePower,
#[rust_sitter::leaf(text = "LogicType.Idle" )]LogicTypeIdle,
#[rust_sitter::leaf(text = "LogicType.Channel2" )]LogicTypeChannel2,
#[rust_sitter::leaf(text = "SlotClass.DirtCanister" )]SlotClassDirtCanister,
#[rust_sitter::leaf(text = "SortingClass.Ices" )]SortingClassIces,
#[rust_sitter::leaf(text = "LogicType.Thrust" )]LogicTypeThrust,
#[rust_sitter::leaf(text = "LogicType.RatioPollutantInput2" )]LogicTypeRatioPollutantInput2,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidNitrousOxideOutput2" )]LogicTypeRatioLiquidNitrousOxideOutput2,
#[rust_sitter::leaf(text = "LogicType.BurnTimeRemaining" )]LogicTypeBurnTimeRemaining,
#[rust_sitter::leaf(text = "SortingClass.Appliances" )]SortingClassAppliances,
#[rust_sitter::leaf(text = "LogicType.TargetZ" )]LogicTypeTargetZ,
#[rust_sitter::leaf(text = "LogicType.SizeZ" )]LogicTypeSizeZ,
#[rust_sitter::leaf(text = "SlotClass.None" )]SlotClassNone,
#[rust_sitter::leaf(text = "SortingClass.Default" )]SortingClassDefault,
#[rust_sitter::leaf(text = "LogicType.Quantity" )]LogicTypeQuantity,
#[rust_sitter::leaf(text = "Vent.Outward" )]VentOutward,
#[rust_sitter::leaf(text = "LogicType.Combustion" )]LogicTypeCombustion,
#[rust_sitter::leaf(text = "LogicType.RatioVolatilesInput" )]LogicTypeRatioVolatilesInput,
#[rust_sitter::leaf(text = "LogicType.RatioOxygen" )]LogicTypeRatioOxygen,
#[rust_sitter::leaf(text = "LogicType.PressureInput2" )]LogicTypePressureInput2,
#[rust_sitter::leaf(text = "LogicType.RatioCarbonDioxideOutput" )]LogicTypeRatioCarbonDioxideOutput,
#[rust_sitter::leaf(text = "EntityState.Decay" )]EntityStateDecay,
#[rust_sitter::leaf(text = "LogicType.TemperatureSetting" )]LogicTypeTemperatureSetting,
#[rust_sitter::leaf(text = "LogicType.RatioNitrogen" )]LogicTypeRatioNitrogen,
#[rust_sitter::leaf(text = "LogicType.TargetX" )]LogicTypeTargetX,
#[rust_sitter::leaf(text = "LogicType.RatioVolatilesInput2" )]LogicTypeRatioVolatilesInput2,
#[rust_sitter::leaf(text = "SlotClass.Cartridge" )]SlotClassCartridge,
#[rust_sitter::leaf(text = "LogicType.SolarIrradiance" )]LogicTypeSolarIrradiance,
#[rust_sitter::leaf(text = "LogicSlotType.SortingClass" )]LogicSlotTypeSortingClass,
#[rust_sitter::leaf(text = "LogicType.VelocityMagnitude" )]LogicTypeVelocityMagnitude,
#[rust_sitter::leaf(text = "LogicType.RatioPollutantOutput" )]LogicTypeRatioPollutantOutput,
#[rust_sitter::leaf(text = "LogicType.ReferenceId" )]LogicTypeReferenceId,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidPollutantInput" )]LogicTypeRatioLiquidPollutantInput,
#[rust_sitter::leaf(text = "LogicType.CompletionRatio" )]LogicTypeCompletionRatio,
#[rust_sitter::leaf(text = "LogicType.Activate" )]LogicTypeActivate,
#[rust_sitter::leaf(text = "LogicType.ForwardY" )]LogicTypeForwardY,
#[rust_sitter::leaf(text = "PowerMode.Idle" )]PowerModeIdle,
#[rust_sitter::leaf(text = "LogicType.OrbitPeriod" )]LogicTypeOrbitPeriod,
#[rust_sitter::leaf(text = "LogicType.Channel6" )]LogicTypeChannel6,
#[rust_sitter::leaf(text = "LogicType.Mode" )]LogicTypeMode,
#[rust_sitter::leaf(text = "LogicType.RatioNitrousOxideInput" )]LogicTypeRatioNitrousOxideInput,
#[rust_sitter::leaf(text = "LogicType.VelocityY" )]LogicTypeVelocityY,
#[rust_sitter::leaf(text = "SortingClass.Food" )]SortingClassFood,
#[rust_sitter::leaf(text = "LogicType.SizeY" )]LogicTypeSizeY,
#[rust_sitter::leaf(text = "LogicType.ReEntryAltitude" )]LogicTypeReEntryAltitude,
#[rust_sitter::leaf(text = "Color.Black" )]ColorBlack,
#[rust_sitter::leaf(text = "AirControl.Pressure" )]AirControlPressure,
#[rust_sitter::leaf(text = "LogicSlotType.PressureWaste" )]LogicSlotTypePressureWaste,
#[rust_sitter::leaf(text = "LogicType.ExportCount" )]LogicTypeExportCount,
#[rust_sitter::leaf(text = "LogicSlotType.FilterType" )]LogicSlotTypeFilterType,
#[rust_sitter::leaf(text = "LogicType.RatioSteam" )]LogicTypeRatioSteam,
#[rust_sitter::leaf(text = "LogicType.ContactTypeId" )]LogicTypeContactTypeId,
#[rust_sitter::leaf(text = "LogicType.TotalMolesInput" )]LogicTypeTotalMolesInput,
#[rust_sitter::leaf(text = "LogicType.Pressure" )]LogicTypePressure,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidVolatilesOutput2" )]LogicTypeRatioLiquidVolatilesOutput2,
#[rust_sitter::leaf(text = "LogicSlotType.Open" )]LogicSlotTypeOpen,
#[rust_sitter::leaf(text = "LogicType.Weight" )]LogicTypeWeight,
#[rust_sitter::leaf(text = "LogicType.TargetY" )]LogicTypeTargetY,
#[rust_sitter::leaf(text = "LogicType.RatioSteamOutput" )]LogicTypeRatioSteamOutput,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidNitrousOxide" )]LogicTypeRatioLiquidNitrousOxide,
#[rust_sitter::leaf(text = "SortingClass.Storage" )]SortingClassStorage,
#[rust_sitter::leaf(text = "TransmitterMode.Passive" )]TransmitterModePassive,
#[rust_sitter::leaf(text = "LogicType.TemperatureInput2" )]LogicTypeTemperatureInput2,
#[rust_sitter::leaf(text = "LogicType.Progress" )]LogicTypeProgress,
#[rust_sitter::leaf(text = "LogicType.CollectableGoods" )]LogicTypeCollectableGoods,
#[rust_sitter::leaf(text = "Greater" )]Greater,
#[rust_sitter::leaf(text = "LogicType.Setting" )]LogicTypeSetting,
#[rust_sitter::leaf(text = "LogicType.RatioOxygenInput" )]LogicTypeRatioOxygenInput,
#[rust_sitter::leaf(text = "LogicType.SignalStrength" )]LogicTypeSignalStrength,
#[rust_sitter::leaf(text = "LogicType.RatioSteamOutput2" )]LogicTypeRatioSteamOutput2,
#[rust_sitter::leaf(text = "LogicSlotType.Damage" )]LogicSlotTypeDamage,
#[rust_sitter::leaf(text = "LogicSlotType.Charge" )]LogicSlotTypeCharge,
#[rust_sitter::leaf(text = "LogicType.RatioPollutant" )]LogicTypeRatioPollutant,
#[rust_sitter::leaf(text = "SlotClass.Back" )]SlotClassBack,
#[rust_sitter::leaf(text = "LogicType.ForceWrite" )]LogicTypeForceWrite,
#[rust_sitter::leaf(text = "SlotClass.DrillHead" )]SlotClassDrillHead,
#[rust_sitter::leaf(text = "GasType.Steam" )]GasTypeSteam,
#[rust_sitter::leaf(text = "TransmitterMode.Active" )]TransmitterModeActive,
#[rust_sitter::leaf(text = "LogicType.EnvironmentEfficiency" )]LogicTypeEnvironmentEfficiency,
#[rust_sitter::leaf(text = "NotEquals" )]NotEquals,
#[rust_sitter::leaf(text = "GasType.LiquidCarbonDioxide" )]GasTypeLiquidCarbonDioxide,
#[rust_sitter::leaf(text = "LogicType.RatioPollutantInput" )]LogicTypeRatioPollutantInput,
#[rust_sitter::leaf(text = "LogicType.RatioWaterInput2" )]LogicTypeRatioWaterInput2,
#[rust_sitter::leaf(text = "LogicType.RatioVolatiles" )]LogicTypeRatioVolatiles,
#[rust_sitter::leaf(text = "LogicType.RatioNitrousOxideOutput2" )]LogicTypeRatioNitrousOxideOutput2,
#[rust_sitter::leaf(text = "GasType.LiquidPollutant" )]GasTypeLiquidPollutant,
#[rust_sitter::leaf(text = "LogicType.NextWeatherEventTime" )]LogicTypeNextWeatherEventTime,
#[rust_sitter::leaf(text = "LogicType.Ratio" )]LogicTypeRatio,
#[rust_sitter::leaf(text = "LogicType.SemiMajorAxis" )]LogicTypeSemiMajorAxis,
#[rust_sitter::leaf(text = "PowerMode.Discharged" )]PowerModeDischarged,
#[rust_sitter::leaf(text = "EntityState.Dead" )]EntityStateDead,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidOxygenOutput" )]LogicTypeRatioLiquidOxygenOutput,
#[rust_sitter::leaf(text = "SortingClass.Atmospherics" )]SortingClassAtmospherics,
#[rust_sitter::leaf(text = "LogicType.PressureOutput2" )]LogicTypePressureOutput2,
#[rust_sitter::leaf(text = "EntityState.Unconscious" )]EntityStateUnconscious,
#[rust_sitter::leaf(text = "PowerMode.Discharging" )]PowerModeDischarging,
#[rust_sitter::leaf(text = "LogicType.Rpm" )]LogicTypeRpm,
#[rust_sitter::leaf(text = "LogicType.RatioSteamInput" )]LogicTypeRatioSteamInput,
#[rust_sitter::leaf(text = "LogicType.Eccentricity" )]LogicTypeEccentricity,
#[rust_sitter::leaf(text = "LogicType.CombustionOutput2" )]LogicTypeCombustionOutput2,
#[rust_sitter::leaf(text = "ElevatorMode.Stationary" )]ElevatorModeStationary,
#[rust_sitter::leaf(text = "LogicType.PassedMoles" )]LogicTypePassedMoles,
#[rust_sitter::leaf(text = "LogicType.Inclination" )]LogicTypeInclination,
#[rust_sitter::leaf(text = "SlotClass.Battery" )]SlotClassBattery,
#[rust_sitter::leaf(text = "SlotClass.AccessCard" )]SlotClassAccessCard,
#[rust_sitter::leaf(text = "Less" )]Less,
#[rust_sitter::leaf(text = "LogicType.Channel5" )]LogicTypeChannel5,
#[rust_sitter::leaf(text = "LogicSlotType.Lock" )]LogicSlotTypeLock,
#[rust_sitter::leaf(text = "LogicType.PowerPotential" )]LogicTypePowerPotential,
#[rust_sitter::leaf(text = "LogicType.Bpm" )]LogicTypeBpm,
#[rust_sitter::leaf(text = "LogicType.RatioCarbonDioxideOutput2" )]LogicTypeRatioCarbonDioxideOutput2,
#[rust_sitter::leaf(text = "SlotClass.ProgrammableChip" )]SlotClassProgrammableChip,
#[rust_sitter::leaf(text = "LogicType.OperationalTemperatureEfficiency" )]LogicTypeOperationalTemperatureEfficiency,
#[rust_sitter::leaf(text = "Color.Blue" )]ColorBlue,
#[rust_sitter::leaf(text = "SlotClass.ScanningHead" )]SlotClassScanningHead,
#[rust_sitter::leaf(text = "LogicType.VelocityZ" )]LogicTypeVelocityZ,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidPollutantOutput2" )]LogicTypeRatioLiquidPollutantOutput2,
#[rust_sitter::leaf(text = "LogicType.FlightControlRule" )]LogicTypeFlightControlRule,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidNitrousOxideInput" )]LogicTypeRatioLiquidNitrousOxideInput,
#[rust_sitter::leaf(text = "Color.Khaki" )]ColorKhaki,
#[rust_sitter::leaf(text = "LogicType.DrillCondition" )]LogicTypeDrillCondition,
#[rust_sitter::leaf(text = "LogicType.TrueAnomaly" )]LogicTypeTrueAnomaly,
#[rust_sitter::leaf(text = "LogicSlotType.Occupied" )]LogicSlotTypeOccupied,
#[rust_sitter::leaf(text = "LogicType.CombustionInput2" )]LogicTypeCombustionInput2,
#[rust_sitter::leaf(text = "LogicType.CombustionOutput" )]LogicTypeCombustionOutput,
#[rust_sitter::leaf(text = "LogicType.MinimumWattsToContact" )]LogicTypeMinimumWattsToContact,
#[rust_sitter::leaf(text = "LogicType.PrefabHash" )]LogicTypePrefabHash,
#[rust_sitter::leaf(text = "LogicType.Apex" )]LogicTypeApex,
#[rust_sitter::leaf(text = "LogicType.Index" )]LogicTypeIndex,
#[rust_sitter::leaf(text = "LogicSlotType.PressureAir" )]LogicSlotTypePressureAir,
#[rust_sitter::leaf(text = "SlotClass.SensorProcessingUnit" )]SlotClassSensorProcessingUnit,
#[rust_sitter::leaf(text = "LogicType.Output" )]LogicTypeOutput,
#[rust_sitter::leaf(text = "LogicType.Channel4" )]LogicTypeChannel4,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidVolatilesInput" )]LogicTypeRatioLiquidVolatilesInput,
#[rust_sitter::leaf(text = "ElevatorMode.Downward" )]ElevatorModeDownward,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidVolatilesOutput" )]LogicTypeRatioLiquidVolatilesOutput,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidPollutantInput2" )]LogicTypeRatioLiquidPollutantInput2,
#[rust_sitter::leaf(text = "LogicType.DryMass" )]LogicTypeDryMass,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidNitrogen" )]LogicTypeRatioLiquidNitrogen,
#[rust_sitter::leaf(text = "LogicType.RatioNitrogenInput" )]LogicTypeRatioNitrogenInput,
#[rust_sitter::leaf(text = "SlotClass.Appliance" )]SlotClassAppliance,
#[rust_sitter::leaf(text = "LogicType.RequestHash" )]LogicTypeRequestHash,
#[rust_sitter::leaf(text = "LogicType.Error" )]LogicTypeError,
#[rust_sitter::leaf(text = "DaylightSensorMode.Vertical" )]DaylightSensorModeVertical,
#[rust_sitter::leaf(text = "LogicType.DistanceAu" )]LogicTypeDistanceAu,
#[rust_sitter::leaf(text = "PowerMode.Charged" )]PowerModeCharged,
#[rust_sitter::leaf(text = "LogicType.RatioWaterOutput2" )]LogicTypeRatioWaterOutput2,
#[rust_sitter::leaf(text = "LogicType.Fuel" )]LogicTypeFuel,
#[rust_sitter::leaf(text = "LogicType.Lock" )]LogicTypeLock,
#[rust_sitter::leaf(text = "LogicSlotType.Seeding" )]LogicSlotTypeSeeding,
#[rust_sitter::leaf(text = "LogicType.ForwardX" )]LogicTypeForwardX,
#[rust_sitter::leaf(text = "LogicType.Harvest" )]LogicTypeHarvest,
#[rust_sitter::leaf(text = "Color.Green" )]ColorGreen,
#[rust_sitter::leaf(text = "Color.Orange" )]ColorOrange,
#[rust_sitter::leaf(text = "SortingClass.Ores" )]SortingClassOres,
#[rust_sitter::leaf(text = "SlotClass.Flare" )]SlotClassFlare,
#[rust_sitter::leaf(text = "LogicSlotType.Pressure" )]LogicSlotTypePressure,
#[rust_sitter::leaf(text = "LogicType.RatioNitrogenInput2" )]LogicTypeRatioNitrogenInput2,
#[rust_sitter::leaf(text = "Color.White" )]ColorWhite,
#[rust_sitter::leaf(text = "LogicType.TemperatureOutput" )]LogicTypeTemperatureOutput,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidPollutantOutput" )]LogicTypeRatioLiquidPollutantOutput,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidCarbonDioxideOutput2" )]LogicTypeRatioLiquidCarbonDioxideOutput2,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidNitrousOxideInput2" )]LogicTypeRatioLiquidNitrousOxideInput2,
#[rust_sitter::leaf(text = "LogicSlotType.Volume" )]LogicSlotTypeVolume,
#[rust_sitter::leaf(text = "DaylightSensorMode.Default" )]DaylightSensorModeDefault,
#[rust_sitter::leaf(text = "SortingClass.Resources" )]SortingClassResources,
#[rust_sitter::leaf(text = "LogicType.RatioVolatilesOutput" )]LogicTypeRatioVolatilesOutput,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidNitrousOxideOutput" )]LogicTypeRatioLiquidNitrousOxideOutput,
#[rust_sitter::leaf(text = "LogicType.Charge" )]LogicTypeCharge,
#[rust_sitter::leaf(text = "LogicType.RequiredPower" )]LogicTypeRequiredPower,
#[rust_sitter::leaf(text = "LogicType.ReturnFuelCost" )]LogicTypeReturnFuelCost,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidOxygenInput2" )]LogicTypeRatioLiquidOxygenInput2,
#[rust_sitter::leaf(text = "LogicType.AutoLand" )]LogicTypeAutoLand,
#[rust_sitter::leaf(text = "GasType.Water" )]GasTypeWater,
#[rust_sitter::leaf(text = "LogicType.LineNumber" )]LogicTypeLineNumber,
#[rust_sitter::leaf(text = "SlotClass.LiquidBottle" )]SlotClassLiquidBottle,
#[rust_sitter::leaf(text = "RobotMode.PathToTarget" )]RobotModePathToTarget,
#[rust_sitter::leaf(text = "LogicSlotType.Efficiency" )]LogicSlotTypeEfficiency,
#[rust_sitter::leaf(text = "LogicType.VerticalRatio" )]LogicTypeVerticalRatio,
#[rust_sitter::leaf(text = "LogicType.Channel1" )]LogicTypeChannel1,
#[rust_sitter::leaf(text = "LogicType.CelestialHash" )]LogicTypeCelestialHash,
#[rust_sitter::leaf(text = "SlotClass.Suit" )]SlotClassSuit,
#[rust_sitter::leaf(text = "LogicType.PressureOutput" )]LogicTypePressureOutput,
#[rust_sitter::leaf(text = "Color.Pink" )]ColorPink,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidCarbonDioxide" )]LogicTypeRatioLiquidCarbonDioxide,
#[rust_sitter::leaf(text = "SlotClass.Circuitboard" )]SlotClassCircuitboard,
#[rust_sitter::leaf(text = "LogicType.Color" )]LogicTypeColor,
#[rust_sitter::leaf(text = "LogicType.TotalMolesOutput" )]LogicTypeTotalMolesOutput,
#[rust_sitter::leaf(text = "GasType.LiquidNitrogen" )]GasTypeLiquidNitrogen,
#[rust_sitter::leaf(text = "LogicType.TotalMolesOutput2" )]LogicTypeTotalMolesOutput2,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidCarbonDioxideInput2" )]LogicTypeRatioLiquidCarbonDioxideInput2,
#[rust_sitter::leaf(text = "LogicType.VelocityRelativeZ" )]LogicTypeVelocityRelativeZ,
#[rust_sitter::leaf(text = "LogicType.Acceleration" )]LogicTypeAcceleration,
#[rust_sitter::leaf(text = "LogicType.Channel0" )]LogicTypeChannel0,
#[rust_sitter::leaf(text = "RobotMode.Follow" )]RobotModeFollow,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidCarbonDioxideInput" )]LogicTypeRatioLiquidCarbonDioxideInput,
#[rust_sitter::leaf(text = "LogicType.RatioOxygenOutput2" )]LogicTypeRatioOxygenOutput2,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidPollutant" )]LogicTypeRatioLiquidPollutant,
#[rust_sitter::leaf(text = "LogicType.TemperatureInput" )]LogicTypeTemperatureInput,
#[rust_sitter::leaf(text = "LogicSlotType.PrefabHash" )]LogicSlotTypePrefabHash,
#[rust_sitter::leaf(text = "LogicType.Volume" )]LogicTypeVolume,
#[rust_sitter::leaf(text = "RobotMode.MoveToTarget" )]RobotModeMoveToTarget,
#[rust_sitter::leaf(text = "LogicType.RatioLiquidNitrogenOutput2" )]LogicTypeRatioLiquidNitrogenOutput2,
#[rust_sitter::leaf(text = "RobotMode.Roam" )]RobotModeRoam,
#[rust_sitter::leaf(text = "SortingClass.Kits" )]SortingClassKits,
#[rust_sitter::leaf(text = "LogicType.TemperatureDifferentialEfficiency" )]LogicTypeTemperatureDifferentialEfficiency,
#[rust_sitter::leaf(text = "GasType.Nitrogen" )]GasTypeNitrogen,
#[rust_sitter::leaf(text = "LogicType.PowerActual" )]LogicTypePowerActual,
#[rust_sitter::leaf(text = "LogicType.SettingInput" )]LogicTypeSettingInput,
#[rust_sitter::leaf(text = "Color.Red" )]ColorRed,
#[rust_sitter::leaf(text = "LogicType.WorkingGasEfficiency" )]LogicTypeWorkingGasEfficiency,
#[rust_sitter::leaf(text = "LogicType.DistanceKm" )]LogicTypeDistanceKm,
#[rust_sitter::leaf(text = "LogicType.Vertical" )]LogicTypeVertical,
#[rust_sitter::leaf(text = "PowerMode.Charging" )]PowerModeCharging,
#[rust_sitter::leaf(text = "LogicType.CombustionLimiter" )]LogicTypeCombustionLimiter,
#[rust_sitter::leaf(text = "LogicType.SolarAngle" )]LogicTypeSolarAngle,
#[rust_sitter::leaf(text = "LogicType.Horizontal" )]LogicTypeHorizontal,
#[rust_sitter::leaf(text = "GasType.LiquidNitrousOxide" )]GasTypeLiquidNitrousOxide,
#[rust_sitter::leaf(text = "RobotMode.Unload" )]RobotModeUnload,
#[rust_sitter::leaf(text = "SortingClass.Clothing" )]SortingClassClothing,
#[rust_sitter::leaf(text = "LogicType.Stress" )]LogicTypeStress,
#[rust_sitter::leaf(text = "LogicType.PressureExternal" )]LogicTypePressureExternal,
#[rust_sitter::leaf(text = "LogicType.Throttle" )]LogicTypeThrottle,
#[rust_sitter::leaf(text = "LogicType.AirRelease" )]LogicTypeAirRelease,
}

View File

@@ -1,145 +0,0 @@
// GENERATED CODE DO NOT MODIFY
#[derive(PartialEq, Debug, IntoStaticStr, AsRefStr)]
pub enum InstructionOp {
#[rust_sitter::leaf(text = "acos" )]Acos,
#[rust_sitter::leaf(text = "label" )]Label,
#[rust_sitter::leaf(text = "bna" )]Bna,
#[rust_sitter::leaf(text = "bgezal" )]Bgezal,
#[rust_sitter::leaf(text = "bgez" )]Bgez,
#[rust_sitter::leaf(text = "bnaz" )]Bnaz,
#[rust_sitter::leaf(text = "bltal" )]Bltal,
#[rust_sitter::leaf(text = "bnezal" )]Bnezal,
#[rust_sitter::leaf(text = "brapz" )]Brapz,
#[rust_sitter::leaf(text = "yield" )]Yield,
#[rust_sitter::leaf(text = "ss" )]Ss,
#[rust_sitter::leaf(text = "sqrt" )]Sqrt,
#[rust_sitter::leaf(text = "atan2" )]Atan2,
#[rust_sitter::leaf(text = "blt" )]Blt,
#[rust_sitter::leaf(text = "brdns" )]Brdns,
#[rust_sitter::leaf(text = "breq" )]Breq,
#[rust_sitter::leaf(text = "poke" )]Poke,
#[rust_sitter::leaf(text = "exp" )]Exp,
#[rust_sitter::leaf(text = "blezal" )]Blezal,
#[rust_sitter::leaf(text = "bnaal" )]Bnaal,
#[rust_sitter::leaf(text = "bapzal" )]Bapzal,
#[rust_sitter::leaf(text = "sbs" )]Sbs,
#[rust_sitter::leaf(text = "select" )]Select,
#[rust_sitter::leaf(text = "bgtz" )]Bgtz,
#[rust_sitter::leaf(text = "alias" )]Alias,
#[rust_sitter::leaf(text = "move" )]Move,
#[rust_sitter::leaf(text = "bapz" )]Bapz,
#[rust_sitter::leaf(text = "ceil" )]Ceil,
#[rust_sitter::leaf(text = "brltz" )]Brltz,
#[rust_sitter::leaf(text = "brne" )]Brne,
#[rust_sitter::leaf(text = "ls" )]Ls,
#[rust_sitter::leaf(text = "pop" )]Pop,
#[rust_sitter::leaf(text = "mul" )]Mul,
#[rust_sitter::leaf(text = "sgez" )]Sgez,
#[rust_sitter::leaf(text = "sin" )]Sin,
#[rust_sitter::leaf(text = "beq" )]Beq,
#[rust_sitter::leaf(text = "bgtzal" )]Bgtzal,
#[rust_sitter::leaf(text = "sne" )]Sne,
#[rust_sitter::leaf(text = "lbs" )]Lbs,
#[rust_sitter::leaf(text = "sub" )]Sub,
#[rust_sitter::leaf(text = "brap" )]Brap,
#[rust_sitter::leaf(text = "floor" )]Floor,
#[rust_sitter::leaf(text = "bnez" )]Bnez,
#[rust_sitter::leaf(text = "jal" )]Jal,
#[rust_sitter::leaf(text = "lbn" )]Lbn,
#[rust_sitter::leaf(text = "beqz" )]Beqz,
#[rust_sitter::leaf(text = "peek" )]Peek,
#[rust_sitter::leaf(text = "asin" )]Asin,
#[rust_sitter::leaf(text = "mod" )]Mod,
#[rust_sitter::leaf(text = "and" )]And,
#[rust_sitter::leaf(text = "blez" )]Blez,
#[rust_sitter::leaf(text = "bltz" )]Bltz,
#[rust_sitter::leaf(text = "s" )]S,
#[rust_sitter::leaf(text = "getd" )]Getd,
#[rust_sitter::leaf(text = "sgtz" )]Sgtz,
#[rust_sitter::leaf(text = "brlt" )]Brlt,
#[rust_sitter::leaf(text = "bapal" )]Bapal,
#[rust_sitter::leaf(text = "seqz" )]Seqz,
#[rust_sitter::leaf(text = "sap" )]Sap,
#[rust_sitter::leaf(text = "l" )]L,
#[rust_sitter::leaf(text = "sdse" )]Sdse,
#[rust_sitter::leaf(text = "j" )]J,
#[rust_sitter::leaf(text = "trunc" )]Trunc,
#[rust_sitter::leaf(text = "beqal" )]Beqal,
#[rust_sitter::leaf(text = "ble" )]Ble,
#[rust_sitter::leaf(text = "sd" )]Sd,
#[rust_sitter::leaf(text = "log" )]Log,
#[rust_sitter::leaf(text = "push" )]Push,
#[rust_sitter::leaf(text = "cos" )]Cos,
#[rust_sitter::leaf(text = "sla" )]Sla,
#[rust_sitter::leaf(text = "sle" )]Sle,
#[rust_sitter::leaf(text = "bgeal" )]Bgeal,
#[rust_sitter::leaf(text = "sltz" )]Sltz,
#[rust_sitter::leaf(text = "bdse" )]Bdse,
#[rust_sitter::leaf(text = "brdse" )]Brdse,
#[rust_sitter::leaf(text = "get" )]Get,
#[rust_sitter::leaf(text = "snanz" )]Snanz,
#[rust_sitter::leaf(text = "xor" )]Xor,
#[rust_sitter::leaf(text = "brna" )]Brna,
#[rust_sitter::leaf(text = "rand" )]Rand,
#[rust_sitter::leaf(text = "hcf" )]Hcf,
#[rust_sitter::leaf(text = "bltzal" )]Bltzal,
#[rust_sitter::leaf(text = "abs" )]Abs,
#[rust_sitter::leaf(text = "srl" )]Srl,
#[rust_sitter::leaf(text = "bne" )]Bne,
#[rust_sitter::leaf(text = "brge" )]Brge,
#[rust_sitter::leaf(text = "sge" )]Sge,
#[rust_sitter::leaf(text = "define" )]Define,
#[rust_sitter::leaf(text = "snaz" )]Snaz,
#[rust_sitter::leaf(text = "brgtz" )]Brgtz,
#[rust_sitter::leaf(text = "brle" )]Brle,
#[rust_sitter::leaf(text = "max" )]Max,
#[rust_sitter::leaf(text = "bleal" )]Bleal,
#[rust_sitter::leaf(text = "sleep" )]Sleep,
#[rust_sitter::leaf(text = "bap" )]Bap,
#[rust_sitter::leaf(text = "bdnsal" )]Bdnsal,
#[rust_sitter::leaf(text = "bnazal" )]Bnazal,
#[rust_sitter::leaf(text = "bdseal" )]Bdseal,
#[rust_sitter::leaf(text = "bnan" )]Bnan,
#[rust_sitter::leaf(text = "brlez" )]Brlez,
#[rust_sitter::leaf(text = "round" )]Round,
#[rust_sitter::leaf(text = "sdns" )]Sdns,
#[rust_sitter::leaf(text = "sra" )]Sra,
#[rust_sitter::leaf(text = "lr" )]Lr,
#[rust_sitter::leaf(text = "seq" )]Seq,
#[rust_sitter::leaf(text = "brnez" )]Brnez,
#[rust_sitter::leaf(text = "brnaz" )]Brnaz,
#[rust_sitter::leaf(text = "bgtal" )]Bgtal,
#[rust_sitter::leaf(text = "lbns" )]Lbns,
#[rust_sitter::leaf(text = "slez" )]Slez,
#[rust_sitter::leaf(text = "snan" )]Snan,
#[rust_sitter::leaf(text = "bgt" )]Bgt,
#[rust_sitter::leaf(text = "lb" )]Lb,
#[rust_sitter::leaf(text = "put" )]Put,
#[rust_sitter::leaf(text = "bneal" )]Bneal,
#[rust_sitter::leaf(text = "atan" )]Atan,
#[rust_sitter::leaf(text = "brgt" )]Brgt,
#[rust_sitter::leaf(text = "or" )]Or,
#[rust_sitter::leaf(text = "add" )]Add,
#[rust_sitter::leaf(text = "sb" )]Sb,
#[rust_sitter::leaf(text = "tan" )]Tan,
#[rust_sitter::leaf(text = "min" )]Min,
#[rust_sitter::leaf(text = "slt" )]Slt,
#[rust_sitter::leaf(text = "brgez" )]Brgez,
#[rust_sitter::leaf(text = "sgt" )]Sgt,
#[rust_sitter::leaf(text = "bge" )]Bge,
#[rust_sitter::leaf(text = "ld" )]Ld,
#[rust_sitter::leaf(text = "sll" )]Sll,
#[rust_sitter::leaf(text = "brnan" )]Brnan,
#[rust_sitter::leaf(text = "beqzal" )]Beqzal,
#[rust_sitter::leaf(text = "sapz" )]Sapz,
#[rust_sitter::leaf(text = "snez" )]Snez,
#[rust_sitter::leaf(text = "sbn" )]Sbn,
#[rust_sitter::leaf(text = "bdns" )]Bdns,
#[rust_sitter::leaf(text = "breqz" )]Breqz,
#[rust_sitter::leaf(text = "div" )]Div,
#[rust_sitter::leaf(text = "not" )]Not,
#[rust_sitter::leaf(text = "nor" )]Nor,
#[rust_sitter::leaf(text = "putd" )]Putd,
#[rust_sitter::leaf(text = "jr" )]Jr,
#[rust_sitter::leaf(text = "sna" )]Sna,
}

View File

@@ -1,284 +0,0 @@
// GENERATED CODE DO NOT MODIFY
#[derive(PartialEq, Debug, IntoStaticStr, AsRefStr)]
pub enum LogicType {
#[rust_sitter::leaf(text = "DryMass" )]DryMass,
#[rust_sitter::leaf(text = "Charge" )]Charge,
#[rust_sitter::leaf(text = "RatioCarbonDioxideInput" )]RatioCarbonDioxideInput,
#[rust_sitter::leaf(text = "Setting" )]Setting,
#[rust_sitter::leaf(text = "Growth" )]Growth,
#[rust_sitter::leaf(text = "Minimum" )]Minimum,
#[rust_sitter::leaf(text = "Weight" )]Weight,
#[rust_sitter::leaf(text = "RatioLiquidNitrousOxideInput" )]RatioLiquidNitrousOxideInput,
#[rust_sitter::leaf(text = "PositionX" )]PositionX,
#[rust_sitter::leaf(text = "Inclination" )]Inclination,
#[rust_sitter::leaf(text = "PressureSetting" )]PressureSetting,
#[rust_sitter::leaf(text = "VelocityZ" )]VelocityZ,
#[rust_sitter::leaf(text = "PositionY" )]PositionY,
#[rust_sitter::leaf(text = "TemperatureOutput2" )]TemperatureOutput2,
#[rust_sitter::leaf(text = "ChargeRatio" )]ChargeRatio,
#[rust_sitter::leaf(text = "Channel7" )]Channel7,
#[rust_sitter::leaf(text = "HorizontalRatio" )]HorizontalRatio,
#[rust_sitter::leaf(text = "PlantHash3" )]PlantHash3,
#[rust_sitter::leaf(text = "PlantGrowth1" )]PlantGrowth1,
#[rust_sitter::leaf(text = "ImportQuantity" )]ImportQuantity,
#[rust_sitter::leaf(text = "Index" )]Index,
#[rust_sitter::leaf(text = "RatioWaterOutput2" )]RatioWaterOutput2,
#[rust_sitter::leaf(text = "FlightControlRule" )]FlightControlRule,
#[rust_sitter::leaf(text = "PrefabHash" )]PrefabHash,
#[rust_sitter::leaf(text = "RatioSteamInput2" )]RatioSteamInput2,
#[rust_sitter::leaf(text = "Bpm" )]Bpm,
#[rust_sitter::leaf(text = "MineablesInQueue" )]MineablesInQueue,
#[rust_sitter::leaf(text = "Channel1" )]Channel1,
#[rust_sitter::leaf(text = "RatioLiquidCarbonDioxide" )]RatioLiquidCarbonDioxide,
#[rust_sitter::leaf(text = "RatioOxygenOutput2" )]RatioOxygenOutput2,
#[rust_sitter::leaf(text = "RatioNitrogenInput2" )]RatioNitrogenInput2,
#[rust_sitter::leaf(text = "TemperatureSetting" )]TemperatureSetting,
#[rust_sitter::leaf(text = "ExportSlotHash" )]ExportSlotHash,
#[rust_sitter::leaf(text = "Output" )]Output,
#[rust_sitter::leaf(text = "RatioSteam" )]RatioSteam,
#[rust_sitter::leaf(text = "Flush" )]Flush,
#[rust_sitter::leaf(text = "SettingOutputHash" )]SettingOutputHash,
#[rust_sitter::leaf(text = "Damage" )]Damage,
#[rust_sitter::leaf(text = "RatioNitrousOxideOutput" )]RatioNitrousOxideOutput,
#[rust_sitter::leaf(text = "TemperatureOutput" )]TemperatureOutput,
#[rust_sitter::leaf(text = "SoundAlert" )]SoundAlert,
#[rust_sitter::leaf(text = "RatioOxygenInput2" )]RatioOxygenInput2,
#[rust_sitter::leaf(text = "OverShootTarget" )]OverShootTarget,
#[rust_sitter::leaf(text = "RequestHash" )]RequestHash,
#[rust_sitter::leaf(text = "PowerRequired" )]PowerRequired,
#[rust_sitter::leaf(text = "Rpm" )]Rpm,
#[rust_sitter::leaf(text = "VelocityRelativeY" )]VelocityRelativeY,
#[rust_sitter::leaf(text = "Vertical" )]Vertical,
#[rust_sitter::leaf(text = "Sum" )]Sum,
#[rust_sitter::leaf(text = "CombustionLimiter" )]CombustionLimiter,
#[rust_sitter::leaf(text = "PressureOutput" )]PressureOutput,
#[rust_sitter::leaf(text = "RatioLiquidCarbonDioxideInput" )]RatioLiquidCarbonDioxideInput,
#[rust_sitter::leaf(text = "RatioLiquidCarbonDioxideInput2" )]RatioLiquidCarbonDioxideInput2,
#[rust_sitter::leaf(text = "Channel5" )]Channel5,
#[rust_sitter::leaf(text = "CurrentResearchPodType" )]CurrentResearchPodType,
#[rust_sitter::leaf(text = "TemperatureDifferentialEfficiency" )]TemperatureDifferentialEfficiency,
#[rust_sitter::leaf(text = "Progress" )]Progress,
#[rust_sitter::leaf(text = "VerticalRatio" )]VerticalRatio,
#[rust_sitter::leaf(text = "RatioWaterOutput" )]RatioWaterOutput,
#[rust_sitter::leaf(text = "SizeX" )]SizeX,
#[rust_sitter::leaf(text = "CelestialHash" )]CelestialHash,
#[rust_sitter::leaf(text = "MaxQuantity" )]MaxQuantity,
#[rust_sitter::leaf(text = "Combustion" )]Combustion,
#[rust_sitter::leaf(text = "OrbitPeriod" )]OrbitPeriod,
#[rust_sitter::leaf(text = "ReferenceId" )]ReferenceId,
#[rust_sitter::leaf(text = "RatioLiquidVolatilesInput" )]RatioLiquidVolatilesInput,
#[rust_sitter::leaf(text = "Horizontal" )]Horizontal,
#[rust_sitter::leaf(text = "ImportCount" )]ImportCount,
#[rust_sitter::leaf(text = "Power" )]Power,
#[rust_sitter::leaf(text = "TotalMoles" )]TotalMoles,
#[rust_sitter::leaf(text = "LineNumber" )]LineNumber,
#[rust_sitter::leaf(text = "TargetY" )]TargetY,
#[rust_sitter::leaf(text = "RatioPollutantOutput" )]RatioPollutantOutput,
#[rust_sitter::leaf(text = "Occupied" )]Occupied,
#[rust_sitter::leaf(text = "Average" )]Average,
#[rust_sitter::leaf(text = "PlantHealth1" )]PlantHealth1,
#[rust_sitter::leaf(text = "ExportCount" )]ExportCount,
#[rust_sitter::leaf(text = "RatioNitrousOxideInput" )]RatioNitrousOxideInput,
#[rust_sitter::leaf(text = "PlantGrowth2" )]PlantGrowth2,
#[rust_sitter::leaf(text = "TotalMolesInput" )]TotalMolesInput,
#[rust_sitter::leaf(text = "RatioLiquidNitrogenOutput" )]RatioLiquidNitrogenOutput,
#[rust_sitter::leaf(text = "CollectableGoods" )]CollectableGoods,
#[rust_sitter::leaf(text = "RatioWaterInput2" )]RatioWaterInput2,
#[rust_sitter::leaf(text = "ImportSlotOccupant" )]ImportSlotOccupant,
#[rust_sitter::leaf(text = "RatioPollutantInput2" )]RatioPollutantInput2,
#[rust_sitter::leaf(text = "ManualResearchRequiredPod" )]ManualResearchRequiredPod,
#[rust_sitter::leaf(text = "RatioOxygenInput" )]RatioOxygenInput,
#[rust_sitter::leaf(text = "RequiredPower" )]RequiredPower,
#[rust_sitter::leaf(text = "DestinationCode" )]DestinationCode,
#[rust_sitter::leaf(text = "Stress" )]Stress,
#[rust_sitter::leaf(text = "Channel3" )]Channel3,
#[rust_sitter::leaf(text = "PositionZ" )]PositionZ,
#[rust_sitter::leaf(text = "PowerPotential" )]PowerPotential,
#[rust_sitter::leaf(text = "SizeZ" )]SizeZ,
#[rust_sitter::leaf(text = "EnvironmentEfficiency" )]EnvironmentEfficiency,
#[rust_sitter::leaf(text = "RatioLiquidCarbonDioxideOutput" )]RatioLiquidCarbonDioxideOutput,
#[rust_sitter::leaf(text = "FilterType" )]FilterType,
#[rust_sitter::leaf(text = "RatioLiquidOxygen" )]RatioLiquidOxygen,
#[rust_sitter::leaf(text = "SolarIrradiance" )]SolarIrradiance,
#[rust_sitter::leaf(text = "ForwardY" )]ForwardY,
#[rust_sitter::leaf(text = "RatioLiquidCarbonDioxideOutput2" )]RatioLiquidCarbonDioxideOutput2,
#[rust_sitter::leaf(text = "Lock" )]Lock,
#[rust_sitter::leaf(text = "RatioCarbonDioxideOutput2" )]RatioCarbonDioxideOutput2,
#[rust_sitter::leaf(text = "Thrust" )]Thrust,
#[rust_sitter::leaf(text = "OccupantHash" )]OccupantHash,
#[rust_sitter::leaf(text = "RatioLiquidOxygenInput" )]RatioLiquidOxygenInput,
#[rust_sitter::leaf(text = "MinimumWattsToContact" )]MinimumWattsToContact,
#[rust_sitter::leaf(text = "PressureEfficiency" )]PressureEfficiency,
#[rust_sitter::leaf(text = "CombustionInput2" )]CombustionInput2,
#[rust_sitter::leaf(text = "Channel4" )]Channel4,
#[rust_sitter::leaf(text = "Idle" )]Idle,
#[rust_sitter::leaf(text = "On" )]On,
#[rust_sitter::leaf(text = "Channel" )]Channel,
#[rust_sitter::leaf(text = "Volume" )]Volume,
#[rust_sitter::leaf(text = "PassedMoles" )]PassedMoles,
#[rust_sitter::leaf(text = "PlantHash2" )]PlantHash2,
#[rust_sitter::leaf(text = "PressureAir" )]PressureAir,
#[rust_sitter::leaf(text = "ExportSlotOccupant" )]ExportSlotOccupant,
#[rust_sitter::leaf(text = "TotalMolesInput2" )]TotalMolesInput2,
#[rust_sitter::leaf(text = "VelocityMagnitude" )]VelocityMagnitude,
#[rust_sitter::leaf(text = "ElevatorSpeed" )]ElevatorSpeed,
#[rust_sitter::leaf(text = "CelestialParentHash" )]CelestialParentHash,
#[rust_sitter::leaf(text = "SettingInput" )]SettingInput,
#[rust_sitter::leaf(text = "Contents" )]Contents,
#[rust_sitter::leaf(text = "Apex" )]Apex,
#[rust_sitter::leaf(text = "AutoLand" )]AutoLand,
#[rust_sitter::leaf(text = "PowerGeneration" )]PowerGeneration,
#[rust_sitter::leaf(text = "RatioLiquidPollutant" )]RatioLiquidPollutant,
#[rust_sitter::leaf(text = "CombustionOutput" )]CombustionOutput,
#[rust_sitter::leaf(text = "RatioVolatilesOutput" )]RatioVolatilesOutput,
#[rust_sitter::leaf(text = "SettingInputHash" )]SettingInputHash,
#[rust_sitter::leaf(text = "RatioVolatilesInput" )]RatioVolatilesInput,
#[rust_sitter::leaf(text = "TrueAnomaly" )]TrueAnomaly,
#[rust_sitter::leaf(text = "RatioLiquidNitrousOxideOutput" )]RatioLiquidNitrousOxideOutput,
#[rust_sitter::leaf(text = "PressureOutput2" )]PressureOutput2,
#[rust_sitter::leaf(text = "DistanceAu" )]DistanceAu,
#[rust_sitter::leaf(text = "RatioNitrogen" )]RatioNitrogen,
#[rust_sitter::leaf(text = "OperationalTemperatureEfficiency" )]OperationalTemperatureEfficiency,
#[rust_sitter::leaf(text = "TargetX" )]TargetX,
#[rust_sitter::leaf(text = "RatioLiquidPollutantOutput2" )]RatioLiquidPollutantOutput2,
#[rust_sitter::leaf(text = "ForceWrite" )]ForceWrite,
#[rust_sitter::leaf(text = "RatioLiquidNitrousOxideOutput2" )]RatioLiquidNitrousOxideOutput2,
#[rust_sitter::leaf(text = "RatioVolatilesInput2" )]RatioVolatilesInput2,
#[rust_sitter::leaf(text = "RatioNitrogenInput" )]RatioNitrogenInput,
#[rust_sitter::leaf(text = "RatioNitrousOxide" )]RatioNitrousOxide,
#[rust_sitter::leaf(text = "TemperatureInput" )]TemperatureInput,
#[rust_sitter::leaf(text = "ThrustToWeight" )]ThrustToWeight,
#[rust_sitter::leaf(text = "RatioSteamOutput" )]RatioSteamOutput,
#[rust_sitter::leaf(text = "PlantHealth3" )]PlantHealth3,
#[rust_sitter::leaf(text = "EntityState" )]EntityState,
#[rust_sitter::leaf(text = "Filtration" )]Filtration,
#[rust_sitter::leaf(text = "Open" )]Open,
#[rust_sitter::leaf(text = "VelocityRelativeZ" )]VelocityRelativeZ,
#[rust_sitter::leaf(text = "Pressure" )]Pressure,
#[rust_sitter::leaf(text = "Unknown" )]Unknown,
#[rust_sitter::leaf(text = "Fuel" )]Fuel,
#[rust_sitter::leaf(text = "RatioLiquidVolatilesOutput2" )]RatioLiquidVolatilesOutput2,
#[rust_sitter::leaf(text = "TimeToDestination" )]TimeToDestination,
#[rust_sitter::leaf(text = "Orientation" )]Orientation,
#[rust_sitter::leaf(text = "ContactTypeId" )]ContactTypeId,
#[rust_sitter::leaf(text = "RatioPollutantOutput2" )]RatioPollutantOutput2,
#[rust_sitter::leaf(text = "WorkingGasEfficiency" )]WorkingGasEfficiency,
#[rust_sitter::leaf(text = "RatioWater" )]RatioWater,
#[rust_sitter::leaf(text = "AlignmentError" )]AlignmentError,
#[rust_sitter::leaf(text = "Recipe" )]Recipe,
#[rust_sitter::leaf(text = "RatioLiquidVolatiles" )]RatioLiquidVolatiles,
#[rust_sitter::leaf(text = "MinWattsToContact" )]MinWattsToContact,
#[rust_sitter::leaf(text = "Plant" )]Plant,
#[rust_sitter::leaf(text = "ClearMemory" )]ClearMemory,
#[rust_sitter::leaf(text = "SettingOutput" )]SettingOutput,
#[rust_sitter::leaf(text = "Health" )]Health,
#[rust_sitter::leaf(text = "Mature" )]Mature,
#[rust_sitter::leaf(text = "TargetZ" )]TargetZ,
#[rust_sitter::leaf(text = "SignalID" )]SignalId,
#[rust_sitter::leaf(text = "PlantHealth4" )]PlantHealth4,
#[rust_sitter::leaf(text = "PressureInput2" )]PressureInput2,
#[rust_sitter::leaf(text = "RatioNitrogenOutput2" )]RatioNitrogenOutput2,
#[rust_sitter::leaf(text = "CompletionRatio" )]CompletionRatio,
#[rust_sitter::leaf(text = "RatioOxygenOutput" )]RatioOxygenOutput,
#[rust_sitter::leaf(text = "Temperature" )]Temperature,
#[rust_sitter::leaf(text = "RatioLiquidVolatilesInput2" )]RatioLiquidVolatilesInput2,
#[rust_sitter::leaf(text = "Color" )]Color,
#[rust_sitter::leaf(text = "RatioOxygen" )]RatioOxygen,
#[rust_sitter::leaf(text = "TemperatureExternal" )]TemperatureExternal,
#[rust_sitter::leaf(text = "Acceleration" )]Acceleration,
#[rust_sitter::leaf(text = "RatioLiquidNitrousOxideInput2" )]RatioLiquidNitrousOxideInput2,
#[rust_sitter::leaf(text = "Error" )]Error,
#[rust_sitter::leaf(text = "RatioLiquidOxygenInput2" )]RatioLiquidOxygenInput2,
#[rust_sitter::leaf(text = "Channel2" )]Channel2,
#[rust_sitter::leaf(text = "ForwardX" )]ForwardX,
#[rust_sitter::leaf(text = "Reagents" )]Reagents,
#[rust_sitter::leaf(text = "CombustionInput" )]CombustionInput,
#[rust_sitter::leaf(text = "Required" )]Required,
#[rust_sitter::leaf(text = "PlantEfficiency3" )]PlantEfficiency3,
#[rust_sitter::leaf(text = "RatioSteamInput" )]RatioSteamInput,
#[rust_sitter::leaf(text = "RatioLiquidPollutantInput2" )]RatioLiquidPollutantInput2,
#[rust_sitter::leaf(text = "RatioLiquidNitrousOxide" )]RatioLiquidNitrousOxide,
#[rust_sitter::leaf(text = "TotalMolesOutput2" )]TotalMolesOutput2,
#[rust_sitter::leaf(text = "PlantHash4" )]PlantHash4,
#[rust_sitter::leaf(text = "CombustionOutput2" )]CombustionOutput2,
#[rust_sitter::leaf(text = "PlantEfficiency2" )]PlantEfficiency2,
#[rust_sitter::leaf(text = "RatioLiquidOxygenOutput" )]RatioLiquidOxygenOutput,
#[rust_sitter::leaf(text = "NextWeatherEventTime" )]NextWeatherEventTime,
#[rust_sitter::leaf(text = "PowerActual" )]PowerActual,
#[rust_sitter::leaf(text = "DrillCondition" )]DrillCondition,
#[rust_sitter::leaf(text = "RatioLiquidVolatilesOutput" )]RatioLiquidVolatilesOutput,
#[rust_sitter::leaf(text = "RatioNitrogenOutput" )]RatioNitrogenOutput,
#[rust_sitter::leaf(text = "BurnTimeRemaining" )]BurnTimeRemaining,
#[rust_sitter::leaf(text = "VelocityX" )]VelocityX,
#[rust_sitter::leaf(text = "MineablesInVicinity" )]MineablesInVicinity,
#[rust_sitter::leaf(text = "AutoShutOff" )]AutoShutOff,
#[rust_sitter::leaf(text = "ImportSlotHash" )]ImportSlotHash,
#[rust_sitter::leaf(text = "ForwardZ" )]ForwardZ,
#[rust_sitter::leaf(text = "RatioNitrousOxideOutput2" )]RatioNitrousOxideOutput2,
#[rust_sitter::leaf(text = "ExportQuantity" )]ExportQuantity,
#[rust_sitter::leaf(text = "PressureWaste" )]PressureWaste,
#[rust_sitter::leaf(text = "Mode" )]Mode,
#[rust_sitter::leaf(text = "PlantEfficiency1" )]PlantEfficiency1,
#[rust_sitter::leaf(text = "Maximum" )]Maximum,
#[rust_sitter::leaf(text = "RatioCarbonDioxideOutput" )]RatioCarbonDioxideOutput,
#[rust_sitter::leaf(text = "VelocityY" )]VelocityY,
#[rust_sitter::leaf(text = "Channel0" )]Channel0,
#[rust_sitter::leaf(text = "RecipeHash" )]RecipeHash,
#[rust_sitter::leaf(text = "RatioLiquidNitrogenOutput2" )]RatioLiquidNitrogenOutput2,
#[rust_sitter::leaf(text = "ReEntryAltitude" )]ReEntryAltitude,
#[rust_sitter::leaf(text = "InterrogationProgress" )]InterrogationProgress,
#[rust_sitter::leaf(text = "RatioNitrousOxideInput2" )]RatioNitrousOxideInput2,
#[rust_sitter::leaf(text = "PlantEfficiency4" )]PlantEfficiency4,
#[rust_sitter::leaf(text = "SignalStrength" )]SignalStrength,
#[rust_sitter::leaf(text = "RatioPollutantInput" )]RatioPollutantInput,
#[rust_sitter::leaf(text = "Harvest" )]Harvest,
#[rust_sitter::leaf(text = "Class" )]Class,
#[rust_sitter::leaf(text = "PlantHash1" )]PlantHash1,
#[rust_sitter::leaf(text = "VolumeOfLiquid" )]VolumeOfLiquid,
#[rust_sitter::leaf(text = "RatioSteamOutput2" )]RatioSteamOutput2,
#[rust_sitter::leaf(text = "ElevatorLevel" )]ElevatorLevel,
#[rust_sitter::leaf(text = "TargetPadIndex" )]TargetPadIndex,
#[rust_sitter::leaf(text = "PressureInternal" )]PressureInternal,
#[rust_sitter::leaf(text = "RatioLiquidNitrogenInput" )]RatioLiquidNitrogenInput,
#[rust_sitter::leaf(text = "RatioWaterInput" )]RatioWaterInput,
#[rust_sitter::leaf(text = "Seeding" )]Seeding,
#[rust_sitter::leaf(text = "None" )]None,
#[rust_sitter::leaf(text = "Ratio" )]Ratio,
#[rust_sitter::leaf(text = "RatioCarbonDioxideInput2" )]RatioCarbonDioxideInput2,
#[rust_sitter::leaf(text = "Eccentricity" )]Eccentricity,
#[rust_sitter::leaf(text = "Throttle" )]Throttle,
#[rust_sitter::leaf(text = "WattsReachingContact" )]WattsReachingContact,
#[rust_sitter::leaf(text = "Bypass" )]Bypass,
#[rust_sitter::leaf(text = "ReturnFuelCost" )]ReturnFuelCost,
#[rust_sitter::leaf(text = "TemperatureInput2" )]TemperatureInput2,
#[rust_sitter::leaf(text = "ExhaustVelocity" )]ExhaustVelocity,
#[rust_sitter::leaf(text = "RatioVolatilesOutput2" )]RatioVolatilesOutput2,
#[rust_sitter::leaf(text = "RatioPollutant" )]RatioPollutant,
#[rust_sitter::leaf(text = "SizeY" )]SizeY,
#[rust_sitter::leaf(text = "PlantGrowth3" )]PlantGrowth3,
#[rust_sitter::leaf(text = "RatioVolatiles" )]RatioVolatiles,
#[rust_sitter::leaf(text = "SemiMajorAxis" )]SemiMajorAxis,
#[rust_sitter::leaf(text = "Time" )]Time,
#[rust_sitter::leaf(text = "VelocityRelativeX" )]VelocityRelativeX,
#[rust_sitter::leaf(text = "Efficiency" )]Efficiency,
#[rust_sitter::leaf(text = "RatioLiquidPollutantInput" )]RatioLiquidPollutantInput,
#[rust_sitter::leaf(text = "DistanceKm" )]DistanceKm,
#[rust_sitter::leaf(text = "RatioLiquidPollutantOutput" )]RatioLiquidPollutantOutput,
#[rust_sitter::leaf(text = "SolarAngle" )]SolarAngle,
#[rust_sitter::leaf(text = "SolarConstant" )]SolarConstant,
#[rust_sitter::leaf(text = "RatioLiquidNitrogenInput2" )]RatioLiquidNitrogenInput2,
#[rust_sitter::leaf(text = "RatioLiquidOxygenOutput2" )]RatioLiquidOxygenOutput2,
#[rust_sitter::leaf(text = "Mass" )]Mass,
#[rust_sitter::leaf(text = "RatioCarbonDioxide" )]RatioCarbonDioxide,
#[rust_sitter::leaf(text = "Quantity" )]Quantity,
#[rust_sitter::leaf(text = "PlantHealth2" )]PlantHealth2,
#[rust_sitter::leaf(text = "TotalMolesOutput" )]TotalMolesOutput,
#[rust_sitter::leaf(text = "PlantGrowth4" )]PlantGrowth4,
#[rust_sitter::leaf(text = "Channel6" )]Channel6,
#[rust_sitter::leaf(text = "SortingClass" )]SortingClass,
#[rust_sitter::leaf(text = "Activate" )]Activate,
#[rust_sitter::leaf(text = "AirRelease" )]AirRelease,
#[rust_sitter::leaf(text = "PressureExternal" )]PressureExternal,
#[rust_sitter::leaf(text = "PressureInput" )]PressureInput,
#[rust_sitter::leaf(text = "RatioLiquidNitrogen" )]RatioLiquidNitrogen,
}

View File

@@ -1,81 +0,0 @@
#[derive(PartialEq, Debug)]
pub struct Register {
pub indirection: u32,
pub target: u8,
}
impl Register {
pub fn from_str(rs: &str) -> Self {
match &rs[..2] {
"sp" => Register {
indirection: 0,
target: 16,
},
"ra" => Register {
indirection: 0,
target: 17,
},
_ => Register {
indirection: rs[1..].chars().filter(|c| c == &'r').count() as u32,
target: rs[1..].replace("r", "").parse().unwrap(),
},
}
}
}
#[derive(PartialEq, Debug)]
pub struct DeviceSpec {
pub device: Device,
pub channel: Option<u32>,
}
impl DeviceSpec {
pub fn from_str(ds: &str) -> Self {
let mut parts = ds.split(":");
let d = parts.next().unwrap();
let channel: Option<u32> = parts.next().map(|c| c.parse().unwrap());
match d.as_bytes()[1] as char {
'b' => DeviceSpec {
device: Device::Db,
channel,
},
'0'..='9' => DeviceSpec {
device: Device::Numbered(d[1..2].parse().unwrap()),
channel,
},
'r' => DeviceSpec {
device: Device::Indirect(Register {
indirection: d[2..].chars().filter(|c| c == &'r').count() as u32,
target: d[2..].replace("r", "").parse().unwrap(),
}),
channel,
},
c => panic!("Bad second char in device spec '{}'", c),
}
}
}
#[derive(PartialEq, Debug)]
pub enum Device {
Db,
Numbered(u8),
Indirect(Register),
}
#[derive(PartialEq, Debug)]
pub struct HashString {
pub string: String,
pub hash: i32,
}
impl HashString {
pub fn from_str(s: &str) -> Self {
let crc = const_crc32::crc32(s.as_bytes()) as i32;
HashString {
string: s.to_string(),
hash: crc,
}
}
}

402
ic10emu/src/interpreter.rs Normal file
View File

@@ -0,0 +1,402 @@
use std::collections::HashMap;
use crate::grammar;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum ICError {
#[error("")]
InstructionPointerOutOfRange(u32),
#[error("")]
RegisterIndexOutOfRange(f64),
#[error("")]
DeviceIndexOutOfRange(f64),
#[error("")]
StackIndexOutOfRange(f64),
#[error("")]
UnknownDeviceID(f64),
#[error("")]
ToFewOperands { provided: u32, desired: u32 },
#[error("")]
TooManyOperands { provided: u32, desired: u32 },
#[error("")]
IncorrectOperandType { index: u32, desired: String },
#[error("")]
UnknownIdentifier(String),
#[error("")]
DeviceNotValue,
}
#[derive(Debug)]
pub struct IC {
pub id: u16,
pub registers: [f64; 18],
pub ip: u32,
pub stack: [f64; 512],
pub aliases: HashMap<String, grammar::Operand>,
pub labels: HashMap<String, u32>,
pub pins: [Option<u16>; 6],
pub code: String,
pub program: Program,
should_yield: bool,
}
#[derive(Debug)]
pub struct Program {
pub instructions: Vec<grammar::Line>,
}
impl Default for Program {
fn default() -> Self {
Program::new()
}
}
impl Program {
pub fn new() -> Self {
Program {
instructions: Vec::new(),
}
}
pub fn try_from_code(input: &str) -> Result<Self, grammar::ParseError> {
let parse_tree = grammar::parse(&input)?;
Ok(Program {
instructions: parse_tree,
})
}
pub fn get_line(&self, line: u32) -> Result<&grammar::Line, ICError> {
self.instructions
.get(line as usize)
.ok_or(ICError::InstructionPointerOutOfRange(line))
}
}
impl IC {
pub fn new(id: u16) -> Self {
IC {
id,
ip: 0,
registers: [0.0; 18],
stack: [0.0; 512],
pins: [None; 6],
program: Program::new(),
code: String::new(),
aliases: HashMap::new(),
labels: HashMap::new(),
should_yield: false,
}
}
pub fn get_real_target(&self, indirection: u32, target: u32) -> Result<f64, ICError> {
let mut i = indirection;
let mut t = target as f64;
while i > 0 {
if let Some(new_t) = self.registers.get(t as usize) {
t = *new_t;
} else {
return Err(ICError::RegisterIndexOutOfRange(t));
}
i -= 1;
}
Ok(t)
}
pub fn get_register(&self, indirection: u32, target: u32) -> Result<f64, ICError> {
let t = self.get_real_target(indirection, target)?;
self.registers
.get(t as usize)
.ok_or(ICError::RegisterIndexOutOfRange(t))
.copied()
}
/// sets a register thorough, recursing through provided indirection, returns value previously
pub fn set_register(
&mut self,
indirection: u32,
target: u32,
val: f64,
) -> Result<f64, ICError> {
let t = self.get_real_target(indirection, target)?;
let old_val = self
.registers
.get(t as usize)
.ok_or(ICError::RegisterIndexOutOfRange(t))
.copied()?;
self.registers[t as usize] = val;
Ok(old_val)
}
pub fn get_ident_value(&self, ident: &String) -> Result<f64, ICError> {
if let Some(operand) = self.aliases.get(ident) {
operand.get_value(self)
} else {
Err(ICError::UnknownIdentifier(ident.clone()))
}
}
/// processes one line of the contained program
pub fn step(&mut self, housing: &mut crate::Device, vm: &mut crate::VM) -> Result<(), ICError> {
use grammar::InstructionOp::*;
use grammar::*;
use ICError::*;
let line = self.program.get_line(self.ip)?;
let result: Result<(), ICError> = if let Some(code) = &line.code {
match code {
grammar::Code::Label(label) => {
self.labels.insert(label.id.name.clone(), self.ip);
Ok(())
}
grammar::Code::Instruction(inst) => 'inst: {
match inst.instruction {
Nop => Ok(()),
Yield => {
self.should_yield = true;
Ok(())
}
Define => match &inst.operands[..] {
[_op1] => Err(ToFewOperands {
provided: 1,
desired: 2,
}),
[name, number] => {
let &Operand::Identifier(ident) = &name else {
break 'inst Err(IncorrectOperandType {
index: 1,
desired: "Name".to_string(),
});
};
let &Operand::Number(num) = &number else {
break 'inst Err(IncorrectOperandType {
index: 2,
desired: "Number".to_string(),
});
};
self.aliases.insert(
ident.name.clone(),
Operand::Number(Number::Float(num.value())),
);
Ok(())
}
oprs => Err(TooManyOperands {
provided: oprs.len() as u32,
desired: 3,
}),
},
Alias => match &inst.operands[..] {
[_op1] => Err(ToFewOperands {
provided: 1,
desired: 2,
}),
[name, device_reg] => {
let &Operand::Identifier(ident) = &name else {
break 'inst Err(IncorrectOperandType {
index: 1,
desired: "Name".to_string(),
});
};
let alias = match &device_reg {
&Operand::RegisterSpec {
indirection,
target,
} => Operand::RegisterSpec {
indirection: *indirection,
target: *target,
},
&Operand::DeviceSpec { device, channel } => {
Operand::DeviceSpec {
device: *device,
channel: *channel,
}
}
_ => {
break 'inst Err(IncorrectOperandType {
index: 2,
desired: "Device Or Register".to_string(),
})
}
};
self.aliases.insert(ident.name.clone(), alias);
Ok(())
}
oprs => Err(TooManyOperands {
provided: oprs.len() as u32,
desired: 2,
}),
},
Move => match &inst.operands[..] {
[_op1] => Err(ToFewOperands {
provided: 1,
desired: 2,
}),
[reg, val] => {
let &Operand::RegisterSpec {
indirection,
target,
} = &reg
else {
break 'inst Err(IncorrectOperandType {
index: 1,
desired: "Register".to_string(),
});
};
let val = val.get_value(self)?;
self.set_register(*indirection, *target, val)?;
Ok(())
}
oprs => Err(TooManyOperands {
provided: oprs.len() as u32,
desired: 2,
}),
},
Breqz => Ok(()),
Sb => Ok(()),
Bgtz => Ok(()),
Beqz => Ok(()),
Blez => Ok(()),
Bapzal => Ok(()),
Tan => Ok(()),
Bapz => Ok(()),
Ble => Ok(()),
Bnez => Ok(()),
J => Ok(()),
Snez => Ok(()),
Snanz => Ok(()),
Xor => Ok(()),
Sdse => Ok(()),
Srl => Ok(()),
Brna => Ok(()),
Sbs => Ok(()),
Bnezal => Ok(()),
Sge => Ok(()),
Bgtal => Ok(()),
Nor => Ok(()),
Bneal => Ok(()),
Label => Ok(()),
Blezal => Ok(()),
Brap => Ok(()),
Log => Ok(()),
Sgez => Ok(()),
Sin => Ok(()),
Seq => Ok(()),
Putd => Ok(()),
Slt => Ok(()),
Snan => Ok(()),
Beqzal => Ok(()),
Bltal => Ok(()),
Lbns => Ok(()),
Poke => Ok(()),
Brlez => Ok(()),
Bdse => Ok(()),
Sleep => Ok(()),
Lb => Ok(()),
Lr => Ok(()),
Slez => Ok(()),
Beqal => Ok(()),
Sdns => Ok(()),
Blt => Ok(()),
Add => Ok(()),
Bdseal => Ok(()),
Beq => Ok(()),
Atan => Ok(()),
Bgtzal => Ok(()),
Mul => Ok(()),
Sra => Ok(()),
Bdns => Ok(()),
Peek => Ok(()),
Sne => Ok(()),
Jr => Ok(()),
Sgt => Ok(()),
Brgt => Ok(()),
Sd => Ok(()),
Brapz => Ok(()),
Breq => Ok(()),
Or => Ok(()),
Bdnsal => Ok(()),
Bna => Ok(()),
Sbn => Ok(()),
Mod => Ok(()),
Asin => Ok(()),
Atan2 => Ok(()),
Bgeal => Ok(()),
Put => Ok(()),
Bgez => Ok(()),
Sapz => Ok(()),
Bleal => Ok(()),
Bltz => Ok(()),
Brlt => Ok(()),
Brltz => Ok(()),
Rand => Ok(()),
Trunc => Ok(()),
Lbn => Ok(()),
Bnazal => Ok(()),
Bne => Ok(()),
Sltz => Ok(()),
Brge => Ok(()),
Div => Ok(()),
Max => Ok(()),
Round => Ok(()),
Sgtz => Ok(()),
Brdns => Ok(()),
Bapal => Ok(()),
Lbs => Ok(()),
Move => Ok(()),
Sla => Ok(()),
And => Ok(()),
Pop => Ok(()),
Brdse => Ok(()),
Sll => Ok(()),
Bap => Ok(()),
Push => Ok(()),
Seqz => Ok(()),
Sub => Ok(()),
Select => Ok(()),
Bge => Ok(()),
Abs => Ok(()),
Brle => Ok(()),
Get => Ok(()),
Brnez => Ok(()),
Snaz => Ok(()),
Bnaal => Ok(()),
Ss => Ok(()),
Exp => Ok(()),
Bgezal => Ok(()),
Bgt => Ok(()),
Brnaz => Ok(()),
Brgtz => Ok(()),
Brnan => Ok(()),
Bltzal => Ok(()),
Floor => Ok(()),
Ceil => Ok(()),
Jal => Ok(()),
L => Ok(()),
Ld => Ok(()),
Bnaz => Ok(()),
Sle => Ok(()),
Sna => Ok(()),
Brne => Ok(()),
Acos => Ok(()),
Bnan => Ok(()),
Cos => Ok(()),
Getd => Ok(()),
Min => Ok(()),
Brgez => Ok(()),
S => Ok(()),
Sap => Ok(()),
Sqrt => Ok(()),
Ls => Ok(()),
Not => Ok(()),
Hcf => Ok(()),
}
}
}
} else {
Ok(())
};
// let ip = housing.i
self.ip += 1;
result
}
}

View File

@@ -2,8 +2,21 @@ use core::f64;
use std::collections::{HashMap, HashSet};
mod tokens;
mod grammar;
mod compiler;
mod interpreter;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum VMError {
#[error("Device with id '{0}' does not exist")]
UnknownId(u16),
#[error("Device with id '{0}' does not have a IC Slot")]
NoIC(u16),
#[error("Code did not compile")]
ParseError(#[from] grammar::ParseError)
}
#[derive(Debug)]
@@ -15,29 +28,16 @@ pub enum FieldType {
#[derive(Debug)]
pub struct LogicField {
field_type: FieldType,
value: f64,
pub field_type: FieldType,
pub value: f64,
}
#[derive(Debug, Default)]
pub struct Device {
pub id: u16,
pub fields: HashMap<u8, LogicField>,
pub ic: Option<IC>
}
#[derive(Debug)]
pub struct IC {
pub id: u16,
pub registers: [f64; 18], // r[0-15]
pub ip: u8,
pub stack: [f64; 512],
pub aliases: HashMap<String, compiler::Operand>,
pub pins: [Option<u16>; 6],
pub code: String,
pub program: compiler::Program,
pub fields: HashMap<u32, LogicField>,
pub ic: Option<interpreter::IC>
}
#[derive(Debug)]
@@ -82,21 +82,6 @@ impl Default for Network {
}
}
impl IC {
pub fn new(id: u16) -> Self {
IC {
id,
ip: 0,
registers: [0.0; 18],
stack: [0.0; 512],
pins: [None; 6],
program: compiler::Program::new(),
code: String::new(),
aliases: HashMap::new(),
}
}
}
impl Device {
pub fn new(id: u16) -> Self {
Device { id, fields: HashMap::new(), ic: None }
@@ -104,11 +89,12 @@ impl Device {
pub fn with_ic(id: u16) -> Self {
let mut device = Device::new(id);
device.ic = Some(IC::new(id));
device.ic = Some(interpreter::IC::new(id));
device
}
}
impl VM {
pub fn new() -> Self {
let id_gen = IdSequenceGenerator::default();
@@ -135,4 +121,13 @@ impl VM {
}
}
pub fn set_code(&mut self, id: u16, code: &str) -> Result<bool, VMError> {
let device = self.devices.get_mut(&id).ok_or(VMError::UnknownId(id))?;
let ic = device.ic.as_mut().ok_or(VMError::NoIC(id))?;
let new_prog = interpreter::Program::try_from_code(code)?;
ic.program = new_prog;
ic.code = code.to_string();
Ok(true)
}
}

78
ic10emu/src/tokens.rs Normal file
View File

@@ -0,0 +1,78 @@
pub struct SplitConsecutiveWithIndices<'a> {
haystack: &'a str,
chars: &'a [char],
start: usize,
}
impl<'a> Iterator for SplitConsecutiveWithIndices<'a> {
type Item = (usize, &'a str);
fn next(&mut self) -> Option<(usize, &'a str)> {
let total = self.haystack.len();
if self.start == total {
return None;
}
let tail = &self.haystack[self.start..];
match tail.find(self.chars) {
Some(start) => {
let end = self.start
+ start
+ 'find_end: {
let mut last = start;
for (index, c) in (&tail[start..]).chars().enumerate() {
if !self.chars.contains(&c) {
break 'find_end index;
}
last = index + c.len_utf8();
}
last
};
let start = self.start + start;
if self.start == start {
//consecutive delim matches, skip to next match
let start = end;
let end = match &self.haystack[start..].find(self.chars) {
Some(i) => start + i,
None => self.haystack.len(),
};
let s = &self.haystack[start..end];
self.start = end;
if s.is_empty() {
None
} else {
Some((start, s))
}
} else {
let s = &self.haystack[self.start..start];
self.start = start;
Some((self.start, s))
}
}
None => {
let s = &self.haystack[self.start..];
self.start = self.haystack.len();
Some((self.start, s))
}
}
}
}
pub trait SplitConsecutiveIndicesExt:
::std::ops::Index<::std::ops::RangeFull, Output = str>
{
fn split_consecutive_with_indices<'p>(
&'p self,
chars: &'p [char],
) -> SplitConsecutiveWithIndices<'p> {
SplitConsecutiveWithIndices {
haystack: &self[..],
chars: chars,
start: 0,
}
}
}
impl SplitConsecutiveIndicesExt for str {}

158
ic10emu_wasm/Cargo.lock generated
View File

@@ -2,6 +2,15 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "autocfg"
version = "1.1.0"
@@ -36,6 +45,21 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68d13f542d70e5b339bf46f6f74704ac052cfd526c58cd87996bd1ef4615b9a0"
[[package]]
name = "convert_case"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "either"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
[[package]]
name = "futures-core"
version = "0.3.30"
@@ -88,11 +112,23 @@ dependencies = [
"slab",
]
[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "ic10emu"
version = "0.1.0"
dependencies = [
"const-crc32",
"convert_case",
"itertools",
"phf",
"phf_codegen",
"regex",
"strum_macros",
]
[[package]]
@@ -108,6 +144,15 @@ dependencies = [
"web-sys",
]
[[package]]
name = "itertools"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
dependencies = [
"either",
]
[[package]]
name = "js-sys"
version = "0.3.69"
@@ -135,6 +180,44 @@ version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "phf"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
"phf_shared",
]
[[package]]
name = "phf_codegen"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a"
dependencies = [
"phf_generator",
"phf_shared",
]
[[package]]
name = "phf_generator"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0"
dependencies = [
"phf_shared",
"rand",
]
[[package]]
name = "phf_shared"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
dependencies = [
"siphasher",
]
[[package]]
name = "pin-project-lite"
version = "0.2.13"
@@ -165,6 +248,62 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
[[package]]
name = "regex"
version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "rustversion"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
[[package]]
name = "siphasher"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "slab"
version = "0.4.9"
@@ -174,6 +313,19 @@ dependencies = [
"autocfg",
]
[[package]]
name = "strum_macros"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946"
dependencies = [
"heck",
"proc-macro2",
"quote",
"rustversion",
"syn",
]
[[package]]
name = "syn"
version = "2.0.53"
@@ -191,6 +343,12 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-segmentation"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
[[package]]
name = "wasm-bindgen"
version = "0.2.92"

View File

@@ -24,6 +24,7 @@
},
"homepage": "https://github.com/ryex/ic10emu#readme",
"devDependencies": {
"@oneidentity/zstd-js": "^1.0.3",
"autoprefixer": "^10.4.19",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^6.10.0",
@@ -45,10 +46,15 @@
"ace-code": "^1.32.7",
"ace-linters": "^1.1.1",
"bootstrap": "^5.3.3",
"bson": "^6.5.0",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"ic10emu_wasm": "file:../ic10emu_wasm/pkg",
"ic10lsp_wasm": "file:../ic10lsp_wasm/pkg",
"jquery": "^3.7.1",
"lzma-web": "^3.0.1",
"uuid": "^9.0.1"
"stream-browserify": "^3.0.0",
"uuid": "^9.0.1",
"vm-browserify": "^1.1.2"
}
}