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 cef5e00f3a
commit fcac3d254a
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 std::fmt::{Display, Formatter, Result as FmtResult};
use super::ty::Type; use crate::trans::ty::Type;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum UnaryOp { pub enum UnaryOp {

View file

@ -1,5 +1,5 @@
use std::fmt::{Display, Formatter, Result as FmtResult}; use std::fmt::{Display, Formatter, Result as FmtResult};
use super::ty::Type; use crate::trans::ty::Type;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum JSLiteral { Num(i64), Str(String), Bool(bool) } 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 crate::trans::ty::*;
use super::parse::Spanned; use crate::read::parse::Spanned;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum PUnaryOp { pub enum PUnaryOp {

View file

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

View file

@ -1,2 +1 @@
pub mod parse; 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 std::fmt::{Display, Formatter, Result as FmtResult};
use crate::trans::ty::Type; use crate::trans::ty::Type;
use super::past::*; use crate::asts::past::*;
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum Delim { Paren, Brack, Brace } pub enum Delim { Paren, Brack, Brace }

View file

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

View file

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