Rewrite everything in rust

This commit is contained in:
Dominic Grimm 2022-07-17 20:24:49 +02:00
parent db5aeb333c
commit ffad349a41
No known key found for this signature in database
GPG key ID: A6C051C716D2CE65
46 changed files with 1698 additions and 2410 deletions

1
hencelisp/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

17
hencelisp/Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "hencelisp"
version = "0.1.0"
edition = "2021"
[lib]
name = "hencelisp"
path = "src/lib/lib.rs"
[[bin]]
name = "hencelisp"
path = "src/bin/main.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
hence = { path = "../hence" }
clap = { version = "3.2.12", features = ["derive"] }

29
hencelisp/src/bin/main.rs Normal file
View file

@ -0,0 +1,29 @@
use clap::{Parser, Subcommand};
use hencelisp::*;
use std::fs;
#[derive(Debug, Parser)]
#[clap(author, version, about, long_about = None)]
struct Cli {
#[clap(subcommand)]
commands: Commands,
}
#[derive(Debug, Subcommand)]
enum Commands {
#[clap(about = "Lexes source code and outputs tokens")]
Lex {
#[clap(value_parser)]
src: String,
},
}
fn main() {
let args = Cli::parse();
match args.commands {
Commands::Lex { src } => {
let source = fs::read_to_string(src).unwrap();
println!("{source}");
}
}
}

View file

@ -0,0 +1 @@
pub fn lex(source: String) {}

1
hencelisp/src/lib/lib.rs Normal file
View file

@ -0,0 +1 @@
pub mod lexer;

3
hencelisp/src/main.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}