Skip to content

Instantly share code, notes, and snippets.

View junlarsen's full-sized avatar

Mats Jun junlarsen

View GitHub Profile
diff --git a/etc/config/kotlin.amazon.properties b/etc/config/kotlin.amazon.properties
index e69de29b..e47fa755 100644
--- a/etc/config/kotlin.amazon.properties
+++ b/etc/config/kotlin.amazon.properties
@@ -0,0 +1,30 @@
+compilers=&kotlin
+compilerType=kotlin
+versionFlag=-version
+objdumper=javap
+instructionSet=java
@junlarsen
junlarsen / build.gradle
Created March 8, 2021 23:04
Parsing LLVM Bitcode JavaCPP
plugins {
id("application")
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.bytedeco:llvm-platform:11.1.0-1.5.5")
name: Deploy on Ubuntu
runs:
using: composite
steps:
- name: Install environment
shell: bash
run: |
cd /root
if [[ "$CI_DEPLOY_PLATFORM" == "linux-armhf" ]]; then
grammar Slede8;
program
: (programNode | NL)+
;
programNode
: (instruction NL)
| block
;
@junlarsen
junlarsen / TargetStubs.h
Created August 26, 2020 16:36
LLVM Targets definition
#define LLVM_TARGET(TargetName) \
void LLVMInitialize##TargetName##TargetInfo(void); \
void LLVMInitialize##TargetName##Target(void); \
void LLVMInitialize##TargetName##TargetMC(void); \
void LLVMInitialize##TargetName##AsmPrinter(void); \
void LLVMInitialize##TargetName##AsmParser(void); \
void LLVMInitialize##TargetName##Disassembler(void);
// Stable Targets
LLVM_TARGET(AArch64)
val triple = LLVM.LLVMGetDefaultTargetTriple()
val target = LLVM.LLVMGetFirstTarget()
val cpu = BytePointer("generic")
val features = BytePointer("")
val machine = LLVM.LLVMCreateTargetMachine(target, triple.string, cpu.string, features.string, 0, 0 ,0)
LLVM.LLVMSetModuleDataLayout(mod, LLVM.LLVMCreateTargetDataLayout(machine))
LLVM.LLVMSetTarget(mod, triple)
LLVM.LLVMTargetMachineEmitToFile(machine, mod, BytePointer("output.o"), LLVM.LLVMObjectFile, BytePointer())
@junlarsen
junlarsen / js-multi-inheritance.ts
Last active November 11, 2019 15:45
Implementation of multi inheritance output for a transpiler in JS
Save New Duplicate & Edit Just Text
// PoC for multiple class inheritance in JavaScript
// This is something your transpiler would emit
//
// If both super classes have a property then the baseclass
// must also have this property. Otherwise you will get ambiguous calls
// when calling BaseClass.BothParentsHaveThis()
interface Reference<T> {
thisRef: T
/*
attempts to implement this
class A {
property num
method test() {
print("A")
}
}
class A {
fun hello() = "hello"
}
class Container {
val container: MutableMap<String, Any> = mutableMapOf()
fun add(label: String, item: Any) {
container.put(label, item)
}