1
1
Fork 0
mirror of https://github.com/azur1s/bobbylisp.git synced 2024-10-16 02:37:40 -05:00

restructure folders

This commit is contained in:
azur 2023-03-03 16:31:11 +07:00
parent 05be758881
commit f8bba1b987
10 changed files with 34 additions and 12 deletions

21
sketch.hlm Normal file
View file

@ -0,0 +1,21 @@
println({
println("Hello");
return let x: num = 17 * 2 in
x + 1;
} + 34);
//----------
let stack = [];
push("Hello");
console.log(pop());
push(17)
push(2)
push(pop() * pop());
push(pop() + 1);
// [35]
push(34)
push(pop() + pop()) // [35] + 34
console.log(pop());

View file

@ -1,5 +1,5 @@
use std::fmt::{Display, Formatter, Result as FmtResult};
use super::ty::Type;
use crate::trans::ty::Type;
#[derive(Clone, Debug)]
pub enum UnaryOp {

View file

@ -1,5 +1,5 @@
use std::fmt::{Display, Formatter, Result as FmtResult};
use super::ty::Type;
use crate::trans::ty::Type;
#[derive(Clone, Debug)]
pub enum JSLiteral { Num(i64), Str(String), Bool(bool) }

3
src/asts/mod.rs Normal file
View file

@ -0,0 +1,3 @@
pub mod past;
pub mod ast;
pub mod js;

View file

@ -1,6 +1,6 @@
use crate::trans::ty::*;
use super::parse::Spanned;
use crate::read::parse::Spanned;
#[derive(Clone, Debug)]
pub enum PUnaryOp {

View file

@ -1,4 +1,5 @@
#![feature(trait_alias)]
pub mod asts;
pub mod read;
pub mod trans;
pub mod args;

View file

@ -1,2 +1 @@
pub mod parse;
pub mod past;

View file

@ -3,7 +3,7 @@ use chumsky::{prelude::*, Stream};
use std::fmt::{Display, Formatter, Result as FmtResult};
use crate::trans::ty::Type;
use super::past::*;
use crate::asts::past::*;
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum Delim { Paren, Brack, Brace }

View file

@ -1,7 +1,7 @@
use crate::read::past::{PExpr, PLiteral, PBinaryOp, PUnaryOp};
use super::{
ast::{Expr, Literal, BinaryOp, UnaryOp},
js::{JSExpr, JSLiteral},
use crate::asts::{
past::*,
ast::*,
js::*,
};
pub fn translate_expr(expr: PExpr) -> Expr {

View file

@ -1,4 +1,2 @@
pub mod ty;
pub mod ast;
pub mod js;
pub mod low;