File tree 4 files changed +26
-3
lines changed
4 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 3
3
4
4
use crate :: ast:: * ;
5
5
6
+ /// Placeholder macro for visiting, It is used instead of calling visitor methods directly.
7
+ /// Would be useful if we need some operation to happen for every visit.
6
8
macro_rules! visit {
7
9
( $expr: expr) => {
8
10
$expr
Original file line number Diff line number Diff line change 1
- pub fn semantic_analysis ( ) { }
1
+ use fuse_ast:: Chunk ;
2
+
3
+ pub struct Semantic < ' a > {
4
+ source : & ' a str ,
5
+ chunk : Chunk ,
6
+ }
7
+
8
+ impl < ' a > Semantic < ' a > {
9
+ pub fn new ( source : & ' a str , chunk : Chunk ) -> Self {
10
+ Self { source, chunk }
11
+ }
12
+ }
Original file line number Diff line number Diff line change @@ -9,3 +9,4 @@ edition.workspace = true
9
9
10
10
[dependencies ]
11
11
fuse_parser = { workspace = true }
12
+ fuse_semantic = { workspace = true }
Original file line number Diff line number Diff line change 1
1
use fuse_parser:: Parser ;
2
+ use fuse_semantic:: Semantic ;
2
3
3
4
fn compile_chunk ( source : & str ) {
4
- let parsed_tree = Parser :: new ( source) . parse ( ) ;
5
- todo ! ( "Compiler isn't done yet!" )
5
+ let parsed = Parser :: new ( source) . parse ( ) ;
6
+ let semantic = Semantic :: new ( source, parsed. chunk . unwrap ( ) ) ;
7
+ }
8
+
9
+ #[ test]
10
+ fn manual_test ( ) {
11
+ compile_chunk ( r#"
12
+ let x = 123
13
+ let y = x
14
+ "# )
6
15
}
You can’t perform that action at this time.
0 commit comments