Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data milestone 2 #33

Merged
merged 20 commits into from
Dec 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -11,15 +11,17 @@ members = [
"ast",
"project",
"ty",
"ir",
"e2e",
"tyvm",
"linter",
"linter",
"codelocation",
"types",
"cachectx",
"typetable",
"scopetable"
]
"types",
"typetable",
"scopetable",
"fir",
"oir",
"scir",
"datatable",
]
resolver = "2"

2 changes: 1 addition & 1 deletion bootstrap/token/lib.ty
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ pub type TokenError = error
| InvalidToken
| UnexpectedEnd

pub type Token = enum(u8) {
pub type Token = enum
| Error
| Defer
| ErrDefer
17 changes: 0 additions & 17 deletions cachectx/Cargo.toml

This file was deleted.

57 changes: 0 additions & 57 deletions cachectx/src/lib.rs

This file was deleted.

7 changes: 7 additions & 0 deletions datatable/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "datatable"
version = "0.1.0"
edition = "2021"

[dependencies]
cranelift-module = "0"
14 changes: 14 additions & 0 deletions datatable/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use cranelift_module::DataId;
use std::collections::BTreeMap;

pub struct DataTable {
pub table: BTreeMap<String, DataId>,
}

impl DataTable {
pub fn new() -> Self {
DataTable {
table: BTreeMap::new(),
}
}
}
1 change: 0 additions & 1 deletion e2e/Cargo.toml
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ typetable = { path = "../typetable" }
lexer = { path = "../lexer" }
token = { path = "../token" }
parser = { path = "../parser" }
ir = { path = "../ir" }
object = { path = "../object" }
objmaker = { path = "../objmaker" }
linter = { path = "../linter" }
7 changes: 3 additions & 4 deletions e2e/src/main.rs
Original file line number Diff line number Diff line change
@@ -4,18 +4,17 @@ use linter::LintSource;
use parser::Parser;
use std::fs::File;
use std::io::Read;
use typetable::TypeTable;

use std::path::Path;
use std::process::Command;

fn main() {
println!("[run] simple exe");
objmaker::from_buffer(
"pub const main = fn() usize {
const m = 7
"const m = 7
pub const main = fn() usize {
const x = 5
return x + m
return x + m
}",
Path::new("main.ty"),
);
9 changes: 5 additions & 4 deletions ebnf.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// use this to test, and this must pass at all times
// https://bnfplayground.pauliankline.com/
<all> ::= (<top_decl>)*
<top_decl> ::= "pub "? ("const " | "let " | "type " | "impl ") <ident> (":" <signature>)? " = " (<trait> | <fn> | <struct> | <tag> | <import> | <error> | <reassign> | <expr> | <enum>)
<top_decl> ::= "pub "? ("const " | "let " | "type " | "impl ") <destructure> (":" <signature>)? " = " (<trait> | <fn> | <struct> | <tag> | <import> | <error> | <reassign> | <expr> | <enum>)
<import> ::= "import " <chars>
<trait> ::= "trait " "{ " (<top_decl)* " }"
<trait> ::= "trait " "{ " (<top_decl>)* " }"
<signature> ::= <val_type> | ("&" | "*")? ("[" <signature> "]" | <ident> ("." <ident>)* | <fn_type>)
<fn_type> ::= "fn" "(" <type_args> ")" ("void" | <signature>)
<type_args> ::= (<type_arg> ("," <type_arg>)*)?
@@ -15,14 +15,15 @@
<for> ::= "for " "(" <expr> ")" (<fn> | <block>)
<while> ::= "while " "(" <expr> ")" (<fn> | <block>)
<match> ::= "match " "(" <expr> ")" "{ " <arm>+ "}"
<arm> ::= <expr> "=> " (<fn> | <block>)
<arm> ::= <expr> "=> " (<fn> | <block> | <or>)
<tag> ::= "tag " ("| " <ident> (":" <signature>)?)+
<enum> ::= "enum" "(" <val_type> ")" ("| " <ident> ("=" <expr>)?)+
<declarators> ::= (<declarator>)*
<declarator> ::= "pub "? <ident> (":" <signature>)?
<destructure> ::= ("{ " <ident> ("," <ident>)* " }") | <ident>
<args> ::= (<arg> ("," <arg>)*)?
<arg> ::= ("self " (": " <signature>)?) | <ident> (":" <signature>)?
<inner_decl> ::= ( "const " | "let ") <ident> (":" <signature>)? "= " <expr>
<inner_decl> ::= ( "const " | "let ") <destructure> (":" <signature>)? "= " <expr>
<reassign> ::= <access> ("= " <expr>)?
<block> ::= "{ " (<inner_decl> | <for> | <while> | <if> | <reassign>)* (<return> | <break>)? "}"
<return> ::= "return " <expr>?
8 changes: 5 additions & 3 deletions ir/Cargo.toml → fir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
[package]
name = "ir"
name = "fir"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ast = { path="../ast" }
oir = { path="../oir" }
symtable = { path="../symtable" }
datatable = { path="../datatable" }
typetable = { path="../typetable" }
scopetable = { path="../scopetable" }
token = { path="../token" }
perror = { path="../perror" }
lexer = { path="../lexer" }
linter = { path="../linter" }
types = { path="../types" }
cranelift-frontend = "0"
cranelift-codegen = "0"
cranelift-module = "0"
Loading
Loading