This commit is contained in:
SimonFJ20 2023-03-14 13:28:17 +01:00
commit 6ede00be64
4 changed files with 64 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

7
Cargo.lock generated Normal file
View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "thiselang"
version = "0.1.0"

8
Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "thiselang"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

48
src/main.rs Normal file
View File

@ -0,0 +1,48 @@
enum TokenType {
InvalidChar,
MalformedString,
MalformedComment,
Int,
Plus,
Minus,
Asterisk,
Slash,
Percent,
LParen,
RParen,
}
struct Position {
index: usize,
line: i32,
col: i32,
}
struct Token {
token_type: TokenType,
pos: Position,
length: usize,
}
struct Lexer<'a> {
text: &'a str,
i: i32,
}
impl<'a> Lexer<'a> {
pub fn new(text: &'a str) -> Self {
Self { text, i: 0 }
}
}
impl<'a> Iterator for Lexer<'a> {
type Item = Token;
fn next(&mut self) -> Option<Self::Item> {
todo!()
}
}
fn main() {
println!("Hello, world!");
}