add print builtin function

This commit is contained in:
2024-10-15 00:28:39 -04:00
parent 290393a62f
commit e0e33c868b
3 changed files with 60 additions and 15 deletions

View File

@@ -64,6 +64,7 @@ pub(crate) enum Op {
FloatCast,
BoolCast,
StringCast,
Print,
}
#[derive(Debug, Clone)]
@@ -121,6 +122,9 @@ impl Token {
"bool" => Ok(Token::Operator(Op::BoolCast)),
"string" => Ok(Token::Operator(Op::StringCast)),
// misc
"print" => Ok(Token::Operator(Op::Print)),
// then variable length keywords
_ => {
if s.starts_with(":") {