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

Tool v1 #48

Merged
merged 104 commits into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from 96 commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
159e747
initial parsing work
Jan 25, 2021
32d3ae5
parse trait declarations
Jan 27, 2021
42a8e80
import statements
Jan 27, 2021
c85792c
clean lexer tree; support method calls
Jan 27, 2021
9e71dda
basic ast skeleton beginnings
Jan 28, 2021
7a4edec
begin ast work
Jan 29, 2021
f767f96
checkpoint while i swap computers
Jan 29, 2021
40eb817
more ast parsing
Jan 29, 2021
8b7f12a
more ast parsing
Jan 29, 2021
e7bdaeb
ast: function appl, func decl, var exp
Jan 31, 2021
80ae5a9
ast: literals
Jan 31, 2021
73c4438
add compiler binary with nice error messages
Feb 1, 2021
d58e28b
ast: return statements, use statements
Feb 1, 2021
d40b2f2
fix error message
Feb 1, 2021
2e347c2
ast: traits
Feb 1, 2021
2a9edf9
more friendly parse error messages
Feb 1, 2021
d02fc85
old email
Feb 1, 2021
afdeef7
semicolons!
Feb 2, 2021
29ae513
byte literals; fix tests
Feb 3, 2021
5f8a909
parse binary and hex literals for byte and bytes32
Feb 4, 2021
9da8276
refactor expression parsing
Feb 4, 2021
8073cea
parse array exprs
Feb 4, 2021
6ddcb49
parse operator expressions
Feb 4, 2021
88e9fa5
type ascriptions
Feb 9, 2021
303f826
parser: polymorphism and trait bounds
Feb 9, 2021
f084b97
default to u64 instead of u32
Feb 10, 2021
720abfa
begin work on match statements
Feb 11, 2021
d23420c
parse structs
Feb 12, 2021
66b641c
refactor
Feb 13, 2021
3f2e581
a few program examples; parse match statements
Feb 13, 2021
f9234a6
lex struct expressions
Feb 16, 2021
4b2b948
parse to AST struct expressions
Feb 16, 2021
9e69615
compile warnings!
Feb 16, 2021
13e6a30
assert_or_warn macro
Feb 16, 2021
2af1365
generic struct parameters
Feb 17, 2021
98b46fa
parse contract/script/predicate
Feb 18, 2021
a11bf95
improve top level failure error message
Feb 18, 2021
937267e
s/ast/parse_tree
Feb 20, 2021
2f389a3
enums
Feb 20, 2021
0747988
begin semantic analysis
Feb 20, 2021
fc38750
begin work on type checking, inferencing, and semantics checking (#11)
sezna Feb 26, 2021
3b028e6
small error msg tweak
Feb 26, 2021
f7261d0
Refactor error and warning handling (#12)
sezna Mar 2, 2021
952ff98
type check predicates
Mar 3, 2021
029ea46
limit number of script main functions
Mar 3, 2021
217aa36
parse generic types for traits
Mar 4, 2021
3bed768
grammar for reassignments and while loops
Mar 4, 2021
ffa2450
variable reassignments; while loops
Mar 4, 2021
3eacf66
check generic type params in function declarations
Mar 4, 2021
6956d71
fix tests
Mar 5, 2021
d31ead1
grammar for inline asm
Mar 5, 2021
d74420a
Asm expressions (#13)
sezna Mar 28, 2021
ae30683
fix only last expr having type annotation; if branch enforcement of h…
Mar 30, 2021
a20104f
Control flow analysis + more (#28)
sezna Apr 16, 2021
d135648
added ignore vscode local settings
leviathanbeak Apr 19, 2021
739917e
added forc commands and restructured files
leviathanbeak Apr 20, 2021
11e77a8
format code
leviathanbeak Apr 20, 2021
f017ceb
ignore node modules
leviathanbeak Apr 22, 2021
5e1ef3b
added syntax highlighting in vscode-forc
leviathanbeak Apr 22, 2021
bdb0746
rename to snippets
leviathanbeak Apr 22, 2021
745e898
change to fume
leviathanbeak Apr 22, 2021
b07251c
added fume-server as a member
leviathanbeak Apr 29, 2021
b00b44a
updated .gitignore with ts files
leviathanbeak Apr 29, 2021
7e3e417
added vscode client
leviathanbeak Apr 29, 2021
0460f9d
update package.json
leviathanbeak Apr 29, 2021
34298f1
added initial fume-server
leviathanbeak Apr 29, 2021
12a0efa
add line_col method for errors and warnings
May 3, 2021
9f056a5
adding capabilities
leviathanbeak May 5, 2021
b87d047
Merge branch 'parser_v1' of github.com:FuelLabs/fuel-vm-hll into afte…
leviathanbeak May 5, 2021
ae616d6
installed ropey
leviathanbeak May 6, 2021
02dd45e
update to new structure
leviathanbeak May 6, 2021
148cdc4
perform diagnostic
leviathanbeak May 6, 2021
e62716a
added text_document
leviathanbeak May 6, 2021
2f33804
remove unused
leviathanbeak May 6, 2021
0fc3079
cargo fmt
leviathanbeak May 6, 2021
365ff18
clean up
leviathanbeak May 7, 2021
e1032e0
introduce better document state managment
leviathanbeak May 11, 2021
56dcfd3
added hover and completion
leviathanbeak May 11, 2021
80eef55
fixed ranges
leviathanbeak May 12, 2021
36ab7d8
added semantic tokens, go to defnition
leviathanbeak May 14, 2021
4f6f43f
remove other go_tos
leviathanbeak May 14, 2021
84bc31f
clean up
leviathanbeak May 16, 2021
4bdbee7
Merge branch 'master' into tool_v1
leviathanbeak May 16, 2021
b09059a
update merging with master
leviathanbeak May 16, 2021
a4b57d9
added clear names
leviathanbeak May 17, 2021
42602aa
move to token references
leviathanbeak May 17, 2021
eb15455
rename to get_diagnostics
leviathanbeak May 18, 2021
eeb2302
fix master conflicts
leviathanbeak May 19, 2021
c91e80b
make public fields
leviathanbeak May 19, 2021
d01a3e7
use core_lang instead of parser
leviathanbeak May 19, 2021
fb19181
adjust to new parse result
leviathanbeak May 19, 2021
a42c443
update plugin start instructions
leviathanbeak May 19, 2021
7e01c64
Merge branch 'master' of github.com:FuelLabs/fuel-vm-hll into tool_v1
leviathanbeak May 19, 2021
3887d77
fix typo
leviathanbeak May 19, 2021
89f8785
clear both lines and values hashmaps
leviathanbeak May 19, 2021
f2b90b9
remove unused enum fields
leviathanbeak May 19, 2021
72dc482
move settings.json ignore to git/info/exclude
leviathanbeak May 20, 2021
8871e3e
re-added appache license
leviathanbeak May 20, 2021
2ce2b04
added MANIFEST_FILE_NAME
leviathanbeak May 20, 2021
ac22cab
formatted toml files
leviathanbeak May 20, 2021
c2923ec
fromatted launch.json
leviathanbeak May 20, 2021
d90d304
add static values for token types
leviathanbeak May 20, 2021
4423391
format
leviathanbeak May 20, 2021
bc231d8
fix typo
leviathanbeak May 21, 2021
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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# Ignore local vscode settings
**/.vscode/settings.json

# Ignore Typescript files
out
node_modules
.vscode-test
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[workspace]

members = ["core_lang", "forc", "test_suite"]
members = ["core_lang", "forc", "test_suite", "fume-server"]

201 changes: 0 additions & 201 deletions LICENSE

This file was deleted.

4 changes: 2 additions & 2 deletions core_lang/src/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use pest::Span;
use std::hash::{Hash, Hasher};
#[derive(Debug, Clone)]
pub struct Ident<'sc> {
pub(crate) primary_name: &'sc str,
pub primary_name: &'sc str,
// sub-names are the stuff after periods
// like x.test.thing.method()
// `test`, `thing`, and `method` are sub-names
// the primary name is `x`
pub(crate) span: Span<'sc>,
pub span: Span<'sc>,
}

// custom implementation of Hash so that namespacing isn't reliant on the span itself, which will
Expand Down
17 changes: 8 additions & 9 deletions core_lang/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod parse_tree;
mod parser;
mod semantic_analysis;

use crate::parse_tree::*;
pub use crate::parse_tree::*;
use crate::parser::{HllParser, Rule};
use crate::{asm_generation::compile_ast_to_asm, error::*};
pub use asm_generation::{AbstractInstructionSet, FinalizedAsm, HllAsmSet};
Expand All @@ -20,10 +20,9 @@ use pest::iterators::Pair;
use pest::Parser;
use semantic_analysis::{TreeType, TypedParseTree};
use std::collections::HashMap;

pub(crate) mod types;
pub(crate) mod utils;
pub(crate) use crate::parse_tree::{Expression, UseStatement, WhileLoop};
pub use crate::parse_tree::{Declaration, Expression, UseStatement, WhileLoop};

pub use error::{CompileError, CompileResult, CompileWarning};
pub use ident::Ident;
Expand Down Expand Up @@ -59,18 +58,18 @@ pub struct ParseTree<'sc> {
/// In a typical programming language, you might have a single root node for your syntax tree.
/// In this language however, we want to expose multiple public functions at the root
/// level so the tree is multi-root.
root_nodes: Vec<AstNode<'sc>>,
span: Span<'sc>,
pub root_nodes: Vec<AstNode<'sc>>,
pub span: Span<'sc>,
}

#[derive(Debug, Clone)]
struct AstNode<'sc> {
content: AstNodeContent<'sc>,
span: Span<'sc>,
pub struct AstNode<'sc> {
pub content: AstNodeContent<'sc>,
pub span: Span<'sc>,
}

#[derive(Debug, Clone)]
pub(crate) enum AstNodeContent<'sc> {
pub enum AstNodeContent<'sc> {
UseStatement(UseStatement<'sc>),
ReturnStatement(ReturnStatement<'sc>),
Declaration(Declaration<'sc>),
Expand Down
4 changes: 2 additions & 2 deletions core_lang/src/parse_tree/call_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use pest::Span;
/// in the expression `a::b::c()`, `a` and `b` are the prefixes and `c` is the suffix.
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct CallPath<'sc> {
pub(crate) prefixes: Vec<Ident<'sc>>,
pub(crate) suffix: Ident<'sc>,
pub prefixes: Vec<Ident<'sc>>,
pub suffix: Ident<'sc>,
}

impl<'sc> std::convert::From<Ident<'sc>> for CallPath<'sc> {
Expand Down
4 changes: 2 additions & 2 deletions core_lang/src/parse_tree/code_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use pest::Span;
use std::collections::HashMap;

#[derive(Debug, Clone)]
pub(crate) struct CodeBlock<'sc> {
pub(crate) contents: Vec<AstNode<'sc>>,
pub struct CodeBlock<'sc> {
pub contents: Vec<AstNode<'sc>>,
pub(crate) scope: HashMap<&'sc str, Declaration<'sc>>,
pub(crate) whole_block_span: Span<'sc>,
}
Expand Down
2 changes: 1 addition & 1 deletion core_lang/src/parse_tree/declaration/enum_declaration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use pest::iterators::Pair;
use pest::Span;
#[derive(Debug, Clone)]
pub struct EnumDeclaration<'sc> {
pub(crate) name: Ident<'sc>,
pub name: Ident<'sc>,
pub(crate) type_parameters: Vec<TypeParameter<'sc>>,
pub(crate) variants: Vec<EnumVariant<'sc>>,
pub(crate) span: Span<'sc>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ impl Visibility {
}

#[derive(Debug, Clone)]
pub(crate) struct FunctionDeclaration<'sc> {
pub(crate) name: Ident<'sc>,
pub struct FunctionDeclaration<'sc> {
pub name: Ident<'sc>,
pub(crate) visibility: Visibility,
pub(crate) body: CodeBlock<'sc>,
pub body: CodeBlock<'sc>,
pub(crate) parameters: Vec<FunctionParameter<'sc>>,
pub(crate) span: pest::Span<'sc>,
pub(crate) return_type: TypeInfo<'sc>,
Expand Down
4 changes: 2 additions & 2 deletions core_lang/src/parse_tree/declaration/impl_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use pest::iterators::Pair;
use pest::Span;

#[derive(Debug, Clone)]
pub(crate) struct ImplTrait<'sc> {
pub struct ImplTrait<'sc> {
pub(crate) trait_name: CallPath<'sc>,
pub(crate) type_implementing_for: TypeInfo<'sc>,
pub(crate) type_arguments: Vec<TypeParameter<'sc>>,
Expand All @@ -18,7 +18,7 @@ pub(crate) struct ImplTrait<'sc> {
/// An impl of methods without a trait
/// like `impl MyType { fn foo { .. } }`
#[derive(Debug, Clone)]
pub(crate) struct ImplSelf<'sc> {
pub struct ImplSelf<'sc> {
pub(crate) type_implementing_for: TypeInfo<'sc>,
pub(crate) type_arguments: Vec<TypeParameter<'sc>>,
pub(crate) functions: Vec<FunctionDeclaration<'sc>>,
Expand Down
4 changes: 2 additions & 2 deletions core_lang/src/parse_tree/declaration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(crate) use reassignment::*;
pub(crate) use struct_declaration::*;
pub(crate) use trait_declaration::*;
pub(crate) use type_parameter::*;
pub(crate) use variable_declaration::*;
pub use variable_declaration::*;

use crate::error::*;
use crate::parse_tree::Expression;
Expand All @@ -24,7 +24,7 @@ use crate::Ident;
use pest::iterators::Pair;

#[derive(Debug, Clone)]
pub(crate) enum Declaration<'sc> {
pub enum Declaration<'sc> {
VariableDeclaration(VariableDeclaration<'sc>),
FunctionDeclaration(FunctionDeclaration<'sc>),
TraitDeclaration(TraitDeclaration<'sc>),
Expand Down
6 changes: 3 additions & 3 deletions core_lang/src/parse_tree/declaration/reassignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use pest::iterators::Pair;
use pest::Span;

#[derive(Debug, Clone)]
pub(crate) struct Reassignment<'sc> {
pub struct Reassignment<'sc> {
// the thing being reassigned
pub(crate) lhs: Ident<'sc>,
pub lhs: Ident<'sc>,
// the expression that is being assigned to the lhs
pub(crate) rhs: Expression<'sc>,
pub rhs: Expression<'sc>,
pub(crate) span: Span<'sc>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::Visibility;

#[derive(Debug, Clone)]
pub struct StructDeclaration<'sc> {
pub(crate) name: Ident<'sc>,
pub name: Ident<'sc>,
pub(crate) fields: Vec<StructField<'sc>>,
pub(crate) type_parameters: Vec<TypeParameter<'sc>>,
pub(crate) visibility: Visibility,
Expand Down
4 changes: 2 additions & 2 deletions core_lang/src/parse_tree/declaration/trait_declaration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use pest::iterators::Pair;
use pest::Span;

#[derive(Debug, Clone)]
pub(crate) struct TraitDeclaration<'sc> {
pub(crate) name: Ident<'sc>,
pub struct TraitDeclaration<'sc> {
pub name: Ident<'sc>,
pub(crate) interface_surface: Vec<TraitFn<'sc>>,
pub(crate) methods: Vec<FunctionDeclaration<'sc>>,
pub(crate) type_parameters: Vec<TypeParameter<'sc>>,
Expand Down
Loading