This commit is contained in:
LunarAkai 2025-08-07 23:30:33 +02:00
commit b1d118a1a2
3 changed files with 16 additions and 7 deletions

View file

@ -7,6 +7,7 @@ Akai Lang (yeah I'm not creative and the name is still unused on github, sooo) i
## Planned Features
- Object-Oriented
- dynamic typing / Type inference
- Rust-like Error handling ( Result<T,E> )
- LLVM Backend
## Hello World

View file

@ -21,8 +21,13 @@ pub enum Expr {
CharLiteral(char),
Null,
Result, // todo
Option, // todo
Ok, // todo
Err, // todo
Call {
callee: Box<Expr>,

View file

@ -1,4 +1,5 @@
use chumsky::input::{Input, Stream};
use chumsky::prelude::end;
use chumsky::Parser;
use logos::Logos;
@ -32,10 +33,10 @@ fn main() {
Err(()) => (Token::Error, span.into()),
});
println!("Token Stream:");
for (token, span) in token_iter.clone() {
println!("{:?} at {:?}", token, span);
}
//println!("Token Stream:");
//for (token, span) in token_iter.clone() {
// println!("{:?} at {:?}", token, span);
//}
// Turn the token iterator into a stream that chumsky can use for things like backtracking
let token_stream = Stream::from_iter(token_iter)
@ -45,15 +46,17 @@ fn main() {
println!("{:?}", sourcecode);
/*
let lexer = Token::lexer(&sourcecode)
.spanned();
//.collect::<Vec<_>>();
for token in lexer {
println!("{:?}", token);
}
}
*/
match parser().parse(token_stream).into_result() {
match parser().then_ignore(end()).parse(token_stream).into_result() {
Ok(res) => println!("{:?}", res),
Err(e) => {
panic!("{:#?}", e)