diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2021-08-30 22:13:08 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2021-09-02 23:46:44 +0200 |
commit | dfe15c16de2f8c80de55ac442ff8d8ff3687fb11 (patch) | |
tree | 36c2989b35995692df4f8d2552eab3de87c2ee8b /src/main.rs | |
download | llvm-kaleidoscope-rs-chapter1.tar.gz llvm-kaleidoscope-rs-chapter1.zip |
ch1: added minimal lexer implementation following chapter 1chapter1
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..361f76f --- /dev/null +++ b/src/main.rs @@ -0,0 +1,18 @@ +mod lexer; + +use lexer::Lexer; +use std::io::Read; + +fn main() { + println!("Lex stdin."); + println!("ENTER to lex current input."); + println!("C-c to exit."); + let mut lex = Lexer::new(std::io::stdin().bytes().filter_map(|v| { + let v = v.ok()?; + Some(v.into()) + })); + + loop { + println!("{:?}", lex.gettok()); + } +} |