-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
789 additions
and
2 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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<()> { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
use inkell::{ | ||
builder::Builder, context::C | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod jit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>) -> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!"); | ||
|