initial commit

This commit is contained in:
2025-10-20 19:29:49 +02:00
commit a9044f62f4
16 changed files with 76 additions and 0 deletions

13
src/literals.lalrpop Normal file
View File

@@ -0,0 +1,13 @@
use std::str::FromStr;
grammar;
pub Atom: f64 = {
<n:Int> => n as f64,
Float,
"(" <Atom> ")",
};
pub Int: i64 = <s:r"[0-9]|[1-9][0-9]*"> => i64::from_str(s).unwrap();
pub Float: f64 = <s:r"[+-]?([0-9]*[.][0-9]+|[0-9]*([.][0-9]+)?[Ee][+-]?[1-9][0-9]*)"> => f64::from_str(s).unwrap();
pub StringLiteral: &'input str = <s:"\"[^\"]\""> => s;