Skip to content

Commit

Permalink
Test Week?!
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaStev committed Jun 18, 2024
1 parent 5f593b3 commit c116dd6
Show file tree
Hide file tree
Showing 9 changed files with 789 additions and 2 deletions.
657 changes: 657 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

27 changes: 26 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,29 @@ description = "Programming Language"
license = "MPL-2"
authors = ["LunaStev <[email protected]>"]

[dependencies]
[dependencies]
pest = "2.1"
pest_derive = "2.1"
anyhow = "1.0"
inkwell = { git = "https://github.com/TheDan64/inkwell", branch = "master", features = [
"llvm14-0",
] } # use correct feature according to your llvm version
rustyline = "12.0"
cfg-if = "1.0"

[lib]
path = "src/lib.rs"

[[bin]]
name = "main"
path = "src/main.rs"
test = false

[[bin]]
name = "repl"
test = false

[features]
jit = []
interpreter = []
vm = []
80 changes: 80 additions & 0 deletions src/ast.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
use std::fmt;

#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Operator {
/** BlockComment */
BC,
/** LineComment */
LC,
/** WhiteSpace */
WS,
/** TAB */
TAB,
/** NewLine */
NL,

FUN, // 함수
VAR, // 문자 변수
COUNT, // 숫자 변수
IF,
FOR,
WHILE,
ELSE,
SWITCH,
CASE,
BREAK,

CONTINUE,
DEFAULT,

ID_ENT, // 식별자
STRING, // 문자열 리터럴
NUMBER(i128), // 숫자 리터럴

AND, // '&&'
OR, // '||'
NOT, // '!'

EQUAL, // '='
GREATER_THAN, // '>'
LEES_THAN, // '<'
GREATER_THAN_EQUAL, // '>='
LESS_THAN_EQUAL, // '<='
EQUAL_EQUAL, // '=='
NOT_EQUAL, // '!='
INCREMENT, // '++'
DECREMENT, // '--'
ARROW, // '->'

TRUE,
FALSE,
NULL,

COMMA, // '.'
SEMI, // ';'
COLON, // ':'

MARKS, // '''
DOUBLE_MARKS, // '"'

L_BRA, // '('
R_BRA, // ')'
L_C_BRA, // '{'
R_C_BRA, // '}'
L_S_BRA, // '['
R_S_BRA, // ']'
L_A_BRA, // '<'
R_A_BRA, // '>'

PLUS, // '+'
MINUS, // '-'
TIMES, // '*'
SLASH, // '/'

IMPORT,
RETURN,
}

impl fmt::Display for Operator {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error>
}
11 changes: 11 additions & 0 deletions src/bin/repl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#![allow(unused_imports, unused_variables)]

use wave::Compile;

cfg_if! {
if #[]
}

fn main() -> Result<()> {

}
3 changes: 3 additions & 0 deletions src/compiler/jit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use inkell::{
builder::Builder, context::C
};
1 change: 1 addition & 0 deletions src/compiler/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod jit;
2 changes: 1 addition & 1 deletion src/lexer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[derive(Debug, PartiaEq, Eq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum Token {
/** BlockComment */
BC,
Expand Down
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pub mod compiler;

pub use crate::ast::{Node, Operator};

pub trait Compile {
type Output;

fn from_ast(ast: Vec<Node>) ->
}
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mod lexer;
mod parser;
mod ast;

fn main() {
println!("Hello World!");
Expand Down

0 comments on commit c116dd6

Please sign in to comment.