-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IFs Generation and FOR corrections (#72 from wesuRage/main)
IFs Generation and FOR corrections
- Loading branch information
Showing
16 changed files
with
337 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
extern int writeln( string) ; | ||
extern string itos( int) ; | ||
extern int writeln(string); | ||
extern string itos(int); | ||
|
||
def main( ) -> int: | ||
def main() -> int: | ||
|
||
for ( int i := 0; i < 100000; ++ i) : | ||
writeln( "val" ) ; | ||
end; | ||
for (int i := -10; i < 10 + 1; ++i): | ||
writeln(itos(i);); | ||
end; | ||
|
||
return 0; | ||
end; | ||
return 0; | ||
end; |
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,16 @@ | ||
#ifndef GENERATE_IF_STMT_H | ||
#define GENERATE_IF_STMT_H | ||
|
||
extern "C" { | ||
#include "frontend/ast/definitions.h" | ||
} | ||
#include <llvm/IR/IRBuilder.h> | ||
#include <llvm/IR/Function.h> | ||
#include <llvm/IR/Type.h> | ||
#include <llvm/IR/Value.h> | ||
#include <llvm/IR/LLVMContext.h> | ||
#include <llvm/IR/BasicBlock.h> | ||
|
||
llvm::Value* generate_if_stmt(IfNode *node, llvm::LLVMContext &Context, llvm::IRBuilder<> &Builder, llvm::Module &Module); | ||
|
||
#endif // GENERATE_IF_STMT_H |
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,22 @@ | ||
#ifndef ITERATOR_STACK_H | ||
#define ITERATOR_STACK_H | ||
|
||
#include <stack> | ||
#include <string> | ||
#include <llvm/IR/Value.h> | ||
#include <mutex> | ||
|
||
struct IteratorInfo { | ||
llvm::Value* declaration; | ||
llvm::Value* value; | ||
llvm::Type* type; | ||
}; | ||
|
||
extern std::stack<IteratorInfo> iterator_stack; | ||
extern std::mutex iterator_stack_mutex; | ||
|
||
void push_iterator(llvm::Value* declaration, llvm::Value* value, llvm::Type* type); | ||
IteratorInfo pop_iterator(); | ||
IteratorInfo* current_iterator(); | ||
|
||
#endif // ITERATOR_STACK_H |
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
Oops, something went wrong.