-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from AjayBrahmakshatriya/master
Added support for reference types and creating named variables with decl
- Loading branch information
Showing
18 changed files
with
163 additions
and
8 deletions.
There are no files selected for viewing
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
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
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
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
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,23 @@ | ||
FUNC_DECL | ||
SCALAR_TYPE (VOID) | ||
STMT_BLOCK | ||
DECL_STMT | ||
SCALAR_TYPE (INT) | ||
VAR (my_var) | ||
NO_INITIALIZATION | ||
EXPR_STMT | ||
ASSIGN_EXPR | ||
VAR_EXPR | ||
VAR (my_var) | ||
INT_CONST (1) | ||
DECL_STMT | ||
SCALAR_TYPE (INT) | ||
VAR (y_0) | ||
VAR_EXPR | ||
VAR (my_var) | ||
void foo (void) { | ||
int my_var; | ||
my_var = 1; | ||
int y_0 = my_var; | ||
} | ||
|
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,23 @@ | ||
FUNC_DECL | ||
SCALAR_TYPE (VOID) | ||
STMT_BLOCK | ||
DECL_STMT | ||
SCALAR_TYPE (INT) | ||
VAR (my_var) | ||
NO_INITIALIZATION | ||
EXPR_STMT | ||
ASSIGN_EXPR | ||
VAR_EXPR | ||
VAR (my_var) | ||
INT_CONST (1) | ||
DECL_STMT | ||
SCALAR_TYPE (INT) | ||
VAR (var0) | ||
VAR_EXPR | ||
VAR (my_var) | ||
void foo (void) { | ||
int my_var; | ||
my_var = 1; | ||
int var0 = my_var; | ||
} | ||
|
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,20 @@ | ||
#include "blocks/c_code_generator.h" | ||
#include "builder/dyn_var.h" | ||
|
||
using builder::dyn_var; | ||
|
||
static void foo(void) { | ||
std::string name = "my_var"; | ||
dyn_var<int> v = builder::with_name(name, true); | ||
v = 1; | ||
dyn_var<int> v1 = builder::with_name(name); | ||
dyn_var<int> y = v1; | ||
} | ||
int main(int argc, char *argv[]) { | ||
builder::builder_context context; | ||
auto ast = context.extract_function_ast(foo, "foo"); | ||
ast->dump(std::cout, 0); | ||
|
||
block::c_code_generator::generate_code(ast, std::cout, 0); | ||
return 0; | ||
} |
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
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
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