Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Commit 50fcb28

Browse files
committed
feat: Add support for typing annotation
1 parent 1ecae6d commit 50fcb28

25 files changed

+602
-433
lines changed

.makim.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ groups:
9494
- target: build.release
9595
args:
9696
build-type: "debug"
97-
extras: "-Ddev=enabled -Db_coverage=true -Doptimization=0" # -Db_sanitize=address
97+
extras: "-Ddev=enabled -Db_coverage=true -Doptimization=0" # -Db_sanitize=address
9898
clean: {{ args.clean }}
9999
asan-options: "fast_unwind_on_malloc=0:verbosity=2:log_threads=1"
100100
lsan-options: "fast_unwind_on_malloc=0:verbosity=2:log_threads=1"

conda/pip.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
containers-sugar ==1.5
2-
makim ==1.6.6
2+
makim ==1.6.7

examples/average.arx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
function average(x y):
2-
(x + y) * 0.5;
1+
fn average(x: float, y: float) -> float:
2+
return (x + y) * 0.5;

examples/constant.arx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
function get_constant(x):
2-
x;
1+
fn get_constant(x: float) -> float:
2+
return x;

examples/fibonacci.arx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
function fib(x):
1+
fn fib(x: float) -> float:
22
if x < 3:
3-
1
3+
return 1;
44
else:
5-
fib(x-1)+fib(x-2)
5+
return fib(x-1)+fib(x-2);

examples/print-star.arx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
extern putchard(char);
22

3-
function print_star(n):
3+
fn print_star(n: float):
44
for i = 1, i < n, 1.0 in
55
putchard(42); # ascii 42 = '*'

examples/sum.arx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
function sum(a b):
1+
fn sum(a: float, b: float) -> float:
22
a + b;

meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ project('arx', 'cpp', 'c',
22
license : 'Apache-2.0',
33
version : '1.6.0', # semantic-release
44
default_options : [
5-
'warning_level=everything',
5+
#'warning_level=everything',
6+
'warning_level=1',
67
'cpp_std=c++20',
78
]
89
)

src/codegen/ast-to-llvm-ir.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ auto ASTToLLVMIRVisitor::visit(PrototypeAST& expr) -> void {
173173
* but keep a reference to it for use below.
174174
*/
175175
auto ASTToLLVMIRVisitor::visit(FunctionAST& expr) -> void {
176-
auto& P = *(expr.Proto);
177-
ArxLLVM::function_protos[expr.Proto->getName()] = std::move(expr.Proto);
176+
auto& P = *(expr.proto);
177+
ArxLLVM::function_protos[expr.proto->getName()] = std::move(expr.proto);
178178
this->getFunction(P.getName());
179179
llvm::Function* TheFunction = this->result_func;
180180

@@ -250,9 +250,9 @@ auto ASTToLLVMIRVisitor::visit(FunctionAST& expr) -> void {
250250
ArxLLVM::named_values[std::string(Arg.getName())] = Alloca;
251251
}
252252

253-
this->emitLocation(*expr.Body.get());
253+
this->emitLocation(*expr.body.get());
254254

255-
expr.Body->accept(*this);
255+
expr.body->accept(*this);
256256
llvm::Value* RetVal = this->result_val;
257257

258258
if (RetVal) {

0 commit comments

Comments
 (0)