Skip to content

Commit e43f52a

Browse files
committed
Add pointer and reference function arguments, start access operator
1 parent 84f68a3 commit e43f52a

File tree

12 files changed

+441
-174
lines changed

12 files changed

+441
-174
lines changed

examples/start/main.asa

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ binary|| :: bool(a : bool, b : bool) #inline {
2929
return false;
3030
}
3131

32+
//binary[] :: int(i : *int, index : int) #inline{
33+
// return *(i+index);
34+
//}
35+
3236
TEST_MACRO :: {printl("Macro works!")};
3337
//
3438
//customObject :: struct{
@@ -47,6 +51,10 @@ printint:: (n : int) {
4751
putchar(48+n);
4852
}
4953

54+
modifyReference::(n : ref int){
55+
n = 4;
56+
}
57+
5058
newline::(){
5159
putchar(10);
5260
}
@@ -57,36 +65,44 @@ newline::(){
5765

5866
main :: (){
5967
//printf("Hello World!");
60-
x = 70+2;
61-
y : uint16 = 4;
68+
//x = 70+2;
69+
//y : uint16 = 4;
6270

63-
x_ptr : *int = &x;
71+
//x_ptr : *int = &x;
72+
//begin : *int = x_ptr;
6473

65-
putchar(x);
66-
x = x+1;
67-
putchar(*x_ptr);
68-
putchar(32);
74+
//putchar(x);
75+
//x = x+1;
76+
//putchar(*x_ptr);
77+
//putchar(32);
6978

70-
arr : *int = malloc(8);
79+
arr : *int = malloc(8*4);
7180

81+
arr[2] = 74;
82+
83+
//modifyReference(x);
84+
//printint(x);
7285

7386
newline();
74-
if(1 || 0){
75-
putchar(72);
76-
}
77-
if(1 || 1){
78-
putchar(73);
79-
}
80-
if(0 || 0){
81-
putchar(72);
82-
}
83-
84-
for (i:0..3){
85-
putchar(32);
86-
for (j:0..(i+1)){
87-
printint(j);
88-
}
89-
}
87+
printint(arr[2]);
88+
89+
newline();
90+
//if(1 || 0){
91+
// putchar(72);
92+
//}
93+
//if(1 || 1){
94+
// putchar(73);
95+
//}
96+
//if(0 || 0){
97+
// putchar(72);
98+
//}
99+
//
100+
//for (i:0..3){
101+
// putchar(32);
102+
// for (j:0..(i+1)){
103+
// printint(j);
104+
// }
105+
//}
90106

91107
newline();
92108
//for (i : 0..100){ // for(<range>){} automatically iterates through range type

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "-g")
2828
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -s -fno-indent -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -Wl,--gc-sections")
2929

3030
add_executable(asa main.cpp main.h tests.cpp tests.h settings.h filemanager.cpp filemanager.h tokenizer.cpp tokenizer.h parser.cpp parser.h dependencies.cpp dependencies.h codegen.cpp codegen.h lexer.cpp lexer.h console.cpp console.h strops.cpp strops.h pch.h llvm.h)
31-
#target_compile_definitions(asa PUBLIC $<$<CONFIG:Debug>:DEBUG>)
31+
target_compile_definitions(asa PUBLIC $<$<CONFIG:Debug>:DEBUG>)
3232

3333
# Debug speed optimizations
3434
if (CMAKE_BUILD_TYPE STREQUAL "Debug")

0 commit comments

Comments
 (0)