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 ## Planned Features
- Object-Oriented - Object-Oriented
- dynamic typing / Type inference - dynamic typing / Type inference
- Rust-like Error handling ( Result<T,E> )
- LLVM Backend - LLVM Backend
## Hello World ## Hello World

View file

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

View file

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