restructure folders

pull/5/head
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;
pub mod parse;

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;