Remove LALRPOP parser

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-02-18 17:55:11 -05:00
parent b0ef49bc2a
commit 2413f9f362

View File

@@ -1,58 +0,0 @@
use std::str::FromStr;
use crate::vm::{
common::Addr,
inst::*,
obj::syn::{unescape_string, ast::*},
reg::*,
};
grammar;
Label: String = {
r"[a-zA-Z_][a-zA-Z0-9_]*" => String::from(<>),
}
Number: u64 = {
<s:r"\$[0-9]+"> => u64::from_str(&s[1..]).unwrap(),
<s:r"\$0x[0-9a-fA-F]+"> => u64::from_str_radix(&s[3..], 16).unwrap(),
<s:r"\$0b[01]+"> => u64::from_str_radix(&s[3..], 2).unwrap(),
}
String: String = {
<s:r#""([^"\\]|\\[\\nrt0"])*""#> => {
let len = s.len();
unescape_string(&s[1..len-1])
}
}
Reg: Reg = {
r"%ip" => todo!(),
r"%sp" => todo!(),
r"%fp" => todo!(),
r"%flags" => todo!(),
r"%nil" => todo!(),
r"%status" => todo!(),
r"%r[0-9]{1,2}" => todo!(),
}
ValueDecl: ValueDecl = {
r"\.u64" <Number> => ValueDecl::U64(<>),
r"\.u32" <Number> => ValueDecl::U32(<>),
r"\.u16" <Number> => ValueDecl::U16(<>),
r"\.u8" <Number> => ValueDecl::U8(<>),
r"\.string" <String> => ValueDecl::String(<>),
r"\.zstring" <String> => ValueDecl::ZString(<>),
}
SectionOrg: SectionOrg = {
<start:Number> => SectionOrg::Start(start),
<start:Number> r"\.\." <end:Number> => SectionOrg::Range(start, end),
}
Section: SectionBlock = {
}
pub Sections: Vec<SectionBlock> = {
<Section*> => <>,
}