Skip to content

Commit

Permalink
refactor: change file extension to ´sl`
Browse files Browse the repository at this point in the history
  • Loading branch information
SrGaabriel committed Sep 5, 2024
1 parent db5b135 commit f3dafb0
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 11 deletions.
12 changes: 6 additions & 6 deletions bard/output/ll/bard.ll
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,24 @@ entry:
%19 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i32 0, i32 0
call void @println_str(i8* %19)
%21 = add i32 2, 0
call i1 @callback(i32 %21, ptr @lambda_294658058)
call i1 @callback(i32 %21, ptr @lambda_966544353)
%25 = add i32 4, 0
call i1 @callback(i32 %25, ptr @lambda_1278852808)
call i1 @callback(i32 %25, ptr @lambda_525968792)
%29 = add i32 8, 0
call i1 @callback(i32 %29, ptr @lambda_1955920234)
call i1 @callback(i32 %29, ptr @lambda_391630194)
ret void
}
define i32 @lambda_294658058(i32 %22) {
define i32 @lambda_966544353(i32 %22) {
entry:
%33 = add i32 %22, 12
ret i32 %33
}
define i32 @lambda_1278852808(i32 %26) {
define i32 @lambda_525968792(i32 %26) {
entry:
%34 = add i32 %26, 24
ret i32 %34
}
define i32 @lambda_1955920234(i32 %30) {
define i32 @lambda_391630194(i32 %30) {
entry:
%35 = add i32 %30, 36
ret i32 %35
Expand Down
2 changes: 1 addition & 1 deletion bard/output/ll/signatures.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"structs":[{"name":"Socket","module":"stdlib","fields":{"id":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"family":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"port":{"type":"me.gabriel.selene.frontend.SeleneType.Int16"},"ip_address":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}}},{"name":"TcpServer","module":"stdlib","fields":{"ip_address":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"port":{"type":"me.gabriel.selene.frontend.SeleneType.Int16"}}}],"functions":[{"module":"stdlib","name":"length","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Self"}],"modifiers":[]},{"module":"stdlib","name":"text","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.String"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Self"}],"modifiers":[]},{"module":"stdlib","name":"printf","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Void"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Any"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"println","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Void"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Any"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"readln","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.String"},"parameters":[],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"arraylen","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Any"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"sin","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"cos","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"tan","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"asin","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"acos","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"atan","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"atan2","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"socket","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"stdlib","name":"bind","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int8"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"stdlib","name":"listen","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"stdlib","name":"accept","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int8"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"stdlib","name":"receive","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int8"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"stdlib","name":"send","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int8"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"stdlib","name":"close","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"bard","name":"callback","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Void"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Lambda","id":"lambda","signature":"(int32) -> int32","parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}}],"modifiers":[]},{"module":"bard","name":"main","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Void"},"parameters":[],"modifiers":[]}],"traits":[{"name":"Collection","functions":[{"module":"stdlib","name":"size","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Self"}],"modifiers":[]},{"module":"stdlib","name":"get","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.String"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Self"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":[]},{"module":"stdlib","name":"push","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Void"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Mutable","id":"mutate","signature":"mut self","baseType":{"type":"me.gabriel.selene.frontend.SeleneType.Self"}},{"type":"me.gabriel.selene.frontend.SeleneType.String"}],"modifiers":[]}]},{"name":"Legible","functions":[{"module":"stdlib","name":"text","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.String"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Self"}],"modifiers":[]}],"impls":[{"struct":"string","trait":"Legible","index":90767234,"module":"stdlib","types":[{"type":"me.gabriel.selene.frontend.SeleneType.String"}]},{"struct":"int32","trait":"Legible","index":1522132780,"module":"stdlib","types":[{"type":"me.gabriel.selene.frontend.SeleneType.String"}]}]},{"name":"CharArray","functions":[{"module":"stdlib","name":"length","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Self"}],"modifiers":[]}],"impls":[{"struct":"string","trait":"CharArray","index":63390,"module":"stdlib","types":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}]}]}]}
{"structs":[{"name":"Socket","module":"stdlib","fields":{"id":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"family":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"port":{"type":"me.gabriel.selene.frontend.SeleneType.Int16"},"ip_address":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}}},{"name":"TcpServer","module":"stdlib","fields":{"ip_address":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"port":{"type":"me.gabriel.selene.frontend.SeleneType.Int16"}}}],"functions":[{"module":"stdlib","name":"length","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Self"}],"modifiers":[]},{"module":"stdlib","name":"text","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.String"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Self"}],"modifiers":[]},{"module":"stdlib","name":"printf","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Void"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Any"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"println","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Void"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Any"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"readln","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.String"},"parameters":[],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"arraylen","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Any"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"sin","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"cos","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"tan","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"asin","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"acos","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"atan","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"atan2","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Float64"},{"type":"me.gabriel.selene.frontend.SeleneType.Float64"}],"modifiers":["INTRINSIC"]},{"module":"stdlib","name":"socket","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"stdlib","name":"bind","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int8"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"stdlib","name":"listen","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"stdlib","name":"accept","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int8"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"stdlib","name":"receive","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int8"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"stdlib","name":"send","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int8"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"stdlib","name":"close","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":["INTERNAL","INTRINSIC"]},{"module":"bard","name":"callback","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Void"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},{"type":"me.gabriel.selene.frontend.SeleneType.Lambda","id":"lambda","signature":"(int32) -> int32","parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}}],"modifiers":[]},{"module":"bard","name":"main","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Void"},"parameters":[],"modifiers":[]}],"traits":[{"name":"Collection","functions":[{"module":"stdlib","name":"size","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Self"}],"modifiers":[]},{"module":"stdlib","name":"get","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.String"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Self"},{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}],"modifiers":[]},{"module":"stdlib","name":"push","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Void"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Mutable","id":"mutate","signature":"mut self","baseType":{"type":"me.gabriel.selene.frontend.SeleneType.Self"}},{"type":"me.gabriel.selene.frontend.SeleneType.String"}],"modifiers":[]}]},{"name":"Legible","functions":[{"module":"stdlib","name":"text","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.String"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Self"}],"modifiers":[]}],"impls":[{"struct":"string","trait":"Legible","index":1522132780,"module":"stdlib","types":[{"type":"me.gabriel.selene.frontend.SeleneType.String"}]},{"struct":"int32","trait":"Legible","index":73181251,"module":"stdlib","types":[{"type":"me.gabriel.selene.frontend.SeleneType.String"}]}]},{"name":"CharArray","functions":[{"module":"stdlib","name":"length","returnType":{"type":"me.gabriel.selene.frontend.SeleneType.Int32"},"parameters":[{"type":"me.gabriel.selene.frontend.SeleneType.Self"}],"modifiers":[]}],"impls":[{"struct":"string","trait":"CharArray","index":504858437,"module":"stdlib","types":[{"type":"me.gabriel.selene.frontend.SeleneType.Int32"}]}]}]}
6 changes: 3 additions & 3 deletions bard/output/ll/stdlib.ll
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
@trait_1522132780 = unnamed_addr constant <{ i16, i16, ptr }> <{
@trait_73181251 = unnamed_addr constant <{ i16, i16, ptr }> <{
i16 8,
i16 8,
ptr @int32.text
}>, align 8
@trait_90767234 = unnamed_addr constant <{ i16, i16, ptr }> <{
@trait_1522132780 = unnamed_addr constant <{ i16, i16, ptr }> <{
i16 8,
i16 8,
ptr @string.text
}>, align 8
@trait_63390 = unnamed_addr constant <{ i16, i16, ptr }> <{
@trait_504858437 = unnamed_addr constant <{ i16, i16, ptr }> <{
i16 8,
i16 8,
ptr @string.length
Expand Down
Binary file modified bard/output/output.exe
Binary file not shown.
File renamed without changes.
4 changes: 4 additions & 0 deletions compiler/src/commonMain/kotlin/SeleneCompilerPlatform.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ interface SeleneCompilerPlatform {
val logger: SeleneLogger

fun exitProcess(status: Int): Nothing

companion object {
val FILE_EXTENSIONS = arrayOf("sl")
}
}
3 changes: 2 additions & 1 deletion compiler/src/commonMain/kotlin/io/LoggedResourceManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package me.gabriel.selene.compiler.io

import kotlinx.serialization.encodeToString
import me.gabriel.selene.analysis.signature.Signatures
import me.gabriel.selene.compiler.SeleneCompilerPlatform
import me.gabriel.selene.compiler.cli.CommandLine
import me.gabriel.selene.compiler.util.fileExtensionOrNull
import me.gabriel.selene.tools.SeleneLogger
Expand All @@ -21,7 +22,7 @@ class LoggedResourceManager(
logger.log(LogLevel.DEBUG) { +"Reading the directory: ${directory}" }
val builder = StringBuilder()
fileSystem.list(directory).forEach {
if (it.fileExtensionOrNull != "wy") return@forEach
if (it.fileExtensionOrNull !in SeleneCompilerPlatform.FILE_EXTENSIONS) return@forEach
logger.log(LogLevel.DEBUG) { +"Reading the file: ${it.name}" }
builder.appendLine(fileSystem.read(it) { readUtf8() })
}
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 f3dafb0

Please sign in to comment.