Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
First Blood (#1)
Browse files Browse the repository at this point in the history
* First Blood

* Add postfix unary

* Fix imports

* Fix
  • Loading branch information
mohanson authored and yejiayu committed Aug 14, 2019
1 parent 6ed6288 commit 4d3474d
Show file tree
Hide file tree
Showing 19 changed files with 7,612 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ typings/

# next.js build output
.next

/examples/foo.ts
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# Minits
TypeScript to LLVM compiler
# minits

Typescript with LLVM backend.

```
$ npm install
$ npm start
```
7 changes: 7 additions & 0 deletions examples/foo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function main(): number {
let a: number = 0;
a++;
a++;
a--;
return a;
}
18 changes: 18 additions & 0 deletions examples/llvm_main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as argv from "commander";
import * as llvm from "llvm-node";
import * as ts from "typescript";

function main() {
const context = new llvm.LLVMContext();
const module = new llvm.Module("test", context);

const intType = llvm.Type.getInt32Ty(context);
const initializer = llvm.ConstantInt.get(context, 0);
const globalVariable = new llvm.GlobalVariable(module, intType, true, llvm.LinkageTypes.InternalLinkage, initializer);

const ll = module.print();
console.log(ll);
llvm.writeBitcodeToFile(module, "/tmp/out.bc");
}

main()

0 comments on commit 4d3474d

Please sign in to comment.