mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
restructure folders
This commit is contained in:
parent
cef5e00f3a
commit
fcac3d254a
21
sketch.hlm
Normal file
21
sketch.hlm
Normal 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());
|
|
@ -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 {
|
|
@ -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
3
src/asts/mod.rs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
pub mod past;
|
||||||
|
pub mod ast;
|
||||||
|
pub mod js;
|
|
@ -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 {
|
|
@ -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;
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
pub mod parse;
|
pub mod parse;
|
||||||
pub mod past;
|
|
|
@ -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 }
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -1,4 +1,2 @@
|
||||||
pub mod ty;
|
pub mod ty;
|
||||||
pub mod ast;
|
|
||||||
pub mod js;
|
|
||||||
pub mod low;
|
pub mod low;
|
Loading…
Reference in a new issue