Skip to content

Commit

Permalink
refactor: change file extension to sn to avoid overlap with slash
Browse files Browse the repository at this point in the history
  • Loading branch information
SrGaabriel committed Sep 6, 2024
1 parent be0e65a commit b36ba48
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@ func main() {

# Brand

The brand of the language is a leaf. The theme color is #f05133.
The icon of the language is a leaf. The theme color is #f05133.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class InstantiationAnalyzer: SingleNodeAnalyzer<InstantiationNode>(Instantiation
node.arguments.forEachIndexed { index, argumentNode ->
val expectedType = types[index]
val providedType = block.resolveExpression(argumentNode)
println("Provided type for ${argumentNode} is $providedType")

if (providedType == null) {
results.errors.add(
Expand All @@ -98,11 +97,9 @@ class InstantiationAnalyzer: SingleNodeAnalyzer<InstantiationNode>(Instantiation
block.declareSymbol(argumentNode.name, newType)
val assignment = block.resolveAssignment(argumentNode.name)
if (assignment != null) {
println("Assigned node $assignment to $newType")
block.defineSymbol(assignment, newType)
}
}
println("New type for ${argumentNode} is $newType")
return@forEachIndexed
}

Expand Down
18 changes: 9 additions & 9 deletions bard/output/ll/bard.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare i32 @strcmp(i8*, i8*)
@trait_1720339 = external constant <{ i16, i16, ptr, ptr, ptr, ptr, ptr }>
@trait_1714550218 = external constant <{ i16, i16, ptr, ptr, ptr, ptr, ptr }>
declare void @println_f64(double)
declare void @println_bool(i1)
declare void @println_i32(i32)
Expand All @@ -11,14 +11,14 @@ declare void @println_str(i8*)
declare i32 @printf(i8*, ...)
define void @main() {
entry:
%0 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1720339, i32 0, i32 2
%0 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1714550218, i32 0, i32 2
%1 = load ptr, ptr %0
%2 = call %List* %1()
%3 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1720339, i32 0, i32 3
%3 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1714550218, i32 0, i32 3
%4 = load ptr, ptr %3
%5 = call i32 %4(%List* %2)
call void @println_i32(i32 %5)
%7 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1720339, i32 0, i32 6
%7 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1714550218, i32 0, i32 6
%8 = load ptr, ptr %7
%9 = alloca [6 x i8], align 1
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i32 0, i32 0
Expand All @@ -34,7 +34,7 @@ entry:
%15 = getelementptr inbounds [6 x i8], [6 x i8]* %9, i32 0, i32 5
store i8 0, i8* %15
call i1 %8(%List* %2, [6 x i8]* %9)
%17 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1720339, i32 0, i32 6
%17 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1714550218, i32 0, i32 6
%18 = load ptr, ptr %17
%19 = alloca [6 x i8], align 1
%20 = getelementptr inbounds [6 x i8], [6 x i8]* %19, i32 0, i32 0
Expand All @@ -50,7 +50,7 @@ entry:
%25 = getelementptr inbounds [6 x i8], [6 x i8]* %19, i32 0, i32 5
store i8 0, i8* %25
call i1 %18(%List* %2, [6 x i8]* %19)
%27 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1720339, i32 0, i32 6
%27 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1714550218, i32 0, i32 6
%28 = load ptr, ptr %27
%29 = alloca [6 x i8], align 1
%30 = getelementptr inbounds [6 x i8], [6 x i8]* %29, i32 0, i32 0
Expand All @@ -66,7 +66,7 @@ entry:
%35 = getelementptr inbounds [6 x i8], [6 x i8]* %29, i32 0, i32 5
store i8 0, i8* %35
call i1 %28(%List* %2, [6 x i8]* %29)
%37 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1720339, i32 0, i32 3
%37 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1714550218, i32 0, i32 3
%38 = load ptr, ptr %37
%39 = call i32 %38(%List* %2)
call void @println_i32(i32 %39)
Expand All @@ -85,10 +85,10 @@ entry:
store i8 0, i8* %47
%48 = getelementptr inbounds [6 x i8], [6 x i8]* %41, i32 0, i32 0
call void @println_str(i8* %48)
%50 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1720339, i32 0, i32 5
%50 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1714550218, i32 0, i32 5
%51 = load ptr, ptr %50
%52 = call %List* %51(%List* %2, ptr @lambda_1278852808)
%54 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1720339, i32 0, i32 3
%54 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1714550218, i32 0, i32 3
%55 = load ptr, ptr %54
%56 = call i32 %55(%List* %52)
call void @println_i32(i32 %56)
Expand Down
2 changes: 1 addition & 1 deletion bard/output/ll/signatures.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions bard/output/ll/stdlib.ll
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare i8* @malloc(i32)
i16 8,
ptr @string.length
}>, align 8
@trait_1720339 = unnamed_addr constant <{ i16, i16, ptr, ptr, ptr, ptr, ptr }> <{
@trait_1714550218 = unnamed_addr constant <{ i16, i16, ptr, ptr, ptr, ptr, ptr }> <{
i16 8,
i16 8,
ptr @List.new,
Expand Down Expand Up @@ -124,10 +124,10 @@ define %List* @List.new() {
entry:
%1 = call i8* @malloc(i32 64)
call void @memset(i8* %1, i32 0, i32 64)
%2 = bitcast i8* %1 to i8**
%2 = bitcast i8* %1 to i8***
%3 = alloca %List, align 8
%4 = getelementptr inbounds %List, %List* %3, i32 0, i32 0
store i8** %2, i8*** %4
store i8*** %2, i8**** %4
%5 = getelementptr inbounds %List, %List* %3, i32 0, i32 1
store i32 0, i32* %5
ret %List* %3
Expand All @@ -148,7 +148,7 @@ entry:
}
define %List* @List.filter(%List* %15, ptr %16) {
entry:
%17 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1720339, i32 0, i32 2
%17 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1714550218, i32 0, i32 2
%18 = load ptr, ptr %17
%19 = call %List* %18()
%20 = alloca i32, align 4
Expand All @@ -169,7 +169,7 @@ for_body1:
%31 = call i1 %16(i8* %30)
br i1 %31, label %label3, label %label5
label3:
%32 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1720339, i32 0, i32 6
%32 = getelementptr inbounds <{i16, i16, ptr, ptr, ptr, ptr, ptr}>, ptr @trait_1714550218, i32 0, i32 6
%33 = load ptr, ptr %32
%34 = getelementptr inbounds %List, %List* %15, i32 0, i32 0
%35 = load i8**, i8*** %34
Expand Down
Binary file modified bard/output/output.exe
Binary file not shown.
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/src/commonMain/kotlin/SeleneCompilerPlatform.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ interface SeleneCompilerPlatform {
fun exitProcess(status: Int): Nothing

companion object {
val FILE_EXTENSIONS = arrayOf("sl")
val FILE_EXTENSIONS = arrayOf("sn")
}
}
1 change: 0 additions & 1 deletion llvm/src/commonMain/kotlin/LLVMCodeGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ class LLVMCodeGenerator: ILLVMCodeGenerator {
}

override fun createTraitObject(obj: TraitObject): String {
println("Object: ${obj.register}")
return """
@${obj.prefix}${obj.register} = unnamed_addr constant <{ i16, i16, ${obj.functions.joinToString(", ") { "ptr" }} }> <{
i16 ${obj.size},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b36ba48

Please sign in to comment.