.
This commit is contained in:
parent
3478da43a3
commit
b1d118a1a2
3 changed files with 16 additions and 7 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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>,
|
||||||
|
|
|
||||||
15
src/main.rs
15
src/main.rs
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue