build: separate bin/lib targets

This commit is contained in:
Jonas Röger 2024-11-10 16:23:34 +01:00
parent e79e44c0df
commit 5275bc33a8
Signed by: jonas
GPG Key ID: 4000EB35E1AE0F07
4 changed files with 16 additions and 12 deletions

View File

@ -6,13 +6,17 @@ version = "0.1.0"
edition = "2021"
[lib]
name = "lispers"
path = "src/lib.rs"
[[bin]]
name = "demo"
path = "src/demo.rs"
path = "src/bin/demo.rs"
[[bin]]
name = "repl"
path = "src/repl.rs"
path = "src/bin/repl.rs"
[dependencies]
as-any = "0.3.1"

View File

@ -1,8 +1,5 @@
mod lisp;
mod parser;
use parser::ExpressionStream;
use crate::lisp::{eval, Environment};
use lispers::lisp::{eval, Environment};
use lispers::parser::ExpressionStream;
fn main() {
let programs = [

View File

@ -1,9 +1,8 @@
use lisp::Expression;
use parser::ParserError;
use lispers::lisp::Expression;
use lispers::parser::ParserError;
use lispers::{lisp, parser};
use std::io::Write;
mod parser;
mod lisp;
fn main() {
let env = lisp::Environment::default();
@ -18,7 +17,9 @@ fn main() {
break;
}
match parser::ExpressionStream::from_char_stream(input.chars()).collect::<Result<Vec<Expression>, ParserError>>() {
match parser::ExpressionStream::from_char_stream(input.chars())
.collect::<Result<Vec<Expression>, ParserError>>()
{
Err(e) => println!("Parser Error: {:?}", e),
Ok(exprs) => {
for expr in exprs {

2
src/lib.rs Normal file
View File

@ -0,0 +1,2 @@
pub mod lisp;
pub mod parser;