Rewrite everything in rust
This commit is contained in:
parent
db5aeb333c
commit
ffad349a41
46 changed files with 1698 additions and 2410 deletions
1
hencelisp/.gitignore
vendored
Normal file
1
hencelisp/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/target
|
17
hencelisp/Cargo.toml
Normal file
17
hencelisp/Cargo.toml
Normal 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
29
hencelisp/src/bin/main.rs
Normal 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}");
|
||||
}
|
||||
}
|
||||
}
|
1
hencelisp/src/lib/lexer.rs
Normal file
1
hencelisp/src/lib/lexer.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub fn lex(source: String) {}
|
1
hencelisp/src/lib/lib.rs
Normal file
1
hencelisp/src/lib/lib.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub mod lexer;
|
3
hencelisp/src/main.rs
Normal file
3
hencelisp/src/main.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue