Skip to content

Commit 4e60a6c

Browse files
committed
get rid of nasm in docs and configuration
1 parent 6ad627e commit 4e60a6c

File tree

8 files changed

+16
-15
lines changed

8 files changed

+16
-15
lines changed

.github/workflows/build-native.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858
platform: i686
5959
- uses: ilammy/msvc-dev-cmd@v1.5.0
6060
- uses: microsoft/setup-msbuild@v1
61+
with:
62+
vs-version: '[7.1,7.2)'
6163
- name: Build with Gradle
6264
run: ./gradlew.bat --no-daemon clean nativeImage
6365
shell: powershell

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
distribution: 'adopt'
1616
cache: gradle
1717
- name: Make Gradle executable and prepare env
18-
run: chmod u+x ./gradlew && sudo apt-get install -y gcc-multilib nasm
18+
run: chmod u+x ./gradlew && sudo apt-get install -y gcc-multilib
1919
- name: Test with Gradle
2020
run: ./gradlew clean test
2121
- name: Cleanup Gradle Cache

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Latte Compiler
2-
[![Tests badge](https://img.shields.io/github/workflow/status/avan1235/latte-compiler/Test?label=Tests)](https://github.com/avan1235/latte-compiler/actions/workflows/test.yaml)
3-
[![Build badge](https://img.shields.io/github/workflow/status/avan1235/latte-compiler/Build%20Native?label=Build)](https://github.com/avan1235/latte-compiler/actions/workflows/build-native.yaml)
4-
[![Github All Releases](https://img.shields.io/github/downloads/avan1235/latte-compiler/total.svg?label=Downloads)](https://github.com/avan1235/latte-compiler/releases/latest)
2+
[![Tests badge](https://img.shields.io/github/actions/workflow/status/avan1235/latte-compiler/test.yaml?branch=master)](https://img.shields.io/github/actions/workflow/status/avan1235/latte-compiler/test.yaml?branch=master)
3+
[![Build badge](https://img.shields.io/github/actions/workflow/status/avan1235/latte-compiler/build-native.yaml?branch=master)](https://img.shields.io/github/actions/workflow/status/avan1235/latte-compiler/build-native.yaml?branch=master)
4+
[![Github All Releases](https://img.shields.io/github/downloads/avan1235/latte-compiler/total.svg?label=downloads)](https://github.com/avan1235/latte-compiler/releases/latest)
55

66
[Latte](https://latte-lang.org/) is originally a JVM language that is fully interoperable with Java.
7-
This project implements a native x64 compiler for this language with no support for interoperability with other languages
8-
but tries to provide an optimized version of native version of this language.
7+
This project implements a native x86 compiler for this language with no support for interoperability with other
8+
languages but tries to provide an optimized version of native version of this language.
99

1010
## Building project
1111

@@ -15,7 +15,6 @@ To build project you need:
1515

1616
- [Java 11](https://adoptopenjdk.net/) to build compiler from Kotlin sources and run Gradle in Java 11 environment
1717
- [gcc](https://gcc.gnu.org/) with `gcc-multilib` to compile [runtime.c](./lib/runtime.c) library file in x86 version
18-
- [nasm](https://www.nasm.us/) to run tests that require compiling program from generated assembly
1918

2019
### Build commands
2120

src/main/kotlin/ml/dev/kotlin/latte/Main.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package ml.dev.kotlin.latte
33
import ml.dev.kotlin.latte.asm.AllocatorStrategy
44
import ml.dev.kotlin.latte.asm.AllocatorStrategyProducer
55
import ml.dev.kotlin.latte.asm.compile
6-
import ml.dev.kotlin.latte.asm.nasm
6+
import ml.dev.kotlin.latte.asm.asm
77
import ml.dev.kotlin.latte.quadruple.optimize
88
import ml.dev.kotlin.latte.quadruple.printInstructions
99
import ml.dev.kotlin.latte.quadruple.toIR
@@ -20,7 +20,7 @@ fun main(args: Array<String>): Unit = args.takeIf { it.isNotEmpty() }?.forEach {
2020
val asmCode = inputFile.runCompiler()
2121
val asmFile = inputFile.withExtension(".s")
2222
asmFile.writeText(asmCode)
23-
nasm(asmFile).run { oFile.delete() }
23+
asm(asmFile).run { oFile.delete() }
2424
exit("OK", exitCode = 0)
2525
} catch (e: LatteException) {
2626
exit("ERROR", e.userMessage, exitCode = 2)

src/main/kotlin/ml/dev/kotlin/latte/asm/Nasm.kt renamed to src/main/kotlin/ml/dev/kotlin/latte/asm/Asm.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ml.dev.kotlin.latte.util.*
44
import java.io.File
55
import java.nio.file.Files
66

7-
fun nasm(assembly: File, libFile: File = DEFAULT_LIB_FILE): CompilationResult {
7+
fun asm(assembly: File, libFile: File = DEFAULT_LIB_FILE): CompilationResult {
88
val o = assembly.withExtension(".o")
99
val result = assembly.withExtension("")
1010
withLibFile(libFile) { lib ->
@@ -33,9 +33,9 @@ private fun withLibFile(libFile: File, action: (File) -> Unit) {
3333

3434
private fun createTempLibFromResources(): File {
3535
val file = Files.createTempFile(exeFile().dir.toPath(), "temp-runtime-", ".o").toFile()
36-
Nasm.javaClass.getResourceAsStream("runtime.o")?.let { file.writeBytes(it.readBytes()) }
36+
Asm.javaClass.getResourceAsStream("runtime.o")?.let { file.writeBytes(it.readBytes()) }
3737
?: throw LatteIllegalStateException("No runtime.o file in resources to use as backup".msg)
3838
return file
3939
}
4040

41-
private object Nasm
41+
private object Asm

src/test/kotlin/ml/dev/kotlin/latte/asm/CompilerDataTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ private fun testCompilerWithAllocatorStrategy(
503503
val inputFile = input?.let { programFile.withExtension(".input", it.trimIndent()) }
504504
val compiled = programFile.runCompiler(strategy = allocator.strategy)
505505
val asmFile = programFile.withExtension(".s", compiled)
506-
val (o, exe) = nasm(asmFile, libFile = File("lib/runtime.o"))
506+
val (o, exe) = asm(asmFile, libFile = File("lib/runtime.o"))
507507
val outFile = programFile.withExtension(".outputTest")
508508
val errFile = programFile.withExtension(".errorTest")
509509
exe.absolutePath(inputFile, outFile, errFile).zeroCode()

src/test/kotlin/ml/dev/kotlin/latte/asm/CompilerFileTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private fun testCompilerWithAllocatorStrategy(
7575
val inputFile = input.withExtension(".input").takeIf { it.exists() }
7676
val compiled = input.runCompiler(strategy = allocator.strategy)
7777
val asmFile = input.withExtension(".${shortcut}.s").apply { writeText(compiled) }
78-
val (o, exe) = nasm(asmFile, libFile = File("lib/runtime.o"))
78+
val (o, exe) = asm(asmFile, libFile = File("lib/runtime.o"))
7979
val outFile = input.withExtension(".${shortcut}.outputTest").apply { createNewFile() }
8080
val errFile = input.withExtension(".${shortcut}.errorTest").apply { createNewFile() }
8181
exe.absolutePath(inputFile, outFile, errFile).zeroCode()

src/test/kotlin/ml/dev/kotlin/latte/asm/OptimizedAsmTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ private fun configuredRunCompiler(
220220
val inputFile = input?.let { programFile.withExtension(".input", it.trimIndent()) }
221221
val code = programFile.runCompiler(true, propagateConstants, simplifyExpr, true, lcse, gcse)
222222
val asmFile = programFile.withExtension(".s", code)
223-
val (o, exe) = nasm(asmFile, libFile = File("lib/runtime.o"))
223+
val (o, exe) = asm(asmFile, libFile = File("lib/runtime.o"))
224224
val outFile = programFile.withExtension(".outputTest")
225225
val errFile = programFile.withExtension(".errorTest")
226226
exe.absolutePath(inputFile, outFile, errFile).zeroCode()

0 commit comments

Comments
 (0)