Skip to content

Instantly share code, notes, and snippets.

View luc-tielen's full-sized avatar

Luc Tielen luc-tielen

View GitHub Profile
@luc-tielen
luc-tielen / prepare-commit-msg
Last active February 2, 2024 13:28 — forked from georgescumihai/prepare-commit-msg
Git pre commit hook to add the jira ticket id to the commit message
#!/bin/sh
# A hook script to prepare the commit log message if the branch name starts with a JIRA ticket.
# It adds the branch name to the commit message, if it is not already part of it.
# https://stackoverflow.com/questions/5894946/how-to-add-gits-branch-name-to-the-commit-message/59831864#59831864
PROJECT_PREFIX="PROJ" # TODO fill in project here
BRANCH_PATH=$(git symbolic-ref -q HEAD) # Something like refs/heads/branch_name
BRANCH_NAME=${BRANCH_PATH##*/} # Get text behind the last / of the branch path
@luc-tielen
luc-tielen / semantic_analysis.ll
Created July 19, 2023 16:10
Eclair semantic analysis compiled to LLVM
declare external ccc ptr @malloc(i32)
declare external ccc void @free(ptr)
declare external ccc void @llvm.memset.p0i8.i64(ptr, i8, i64, i1)
declare external ccc void @llvm.memcpy.p0i8.p0i8.i64(ptr, ptr, i64, i1)
declare external ccc i32 @memcmp(ptr, ptr, i64)
@luc-tielen
luc-tielen / compile_to_wasm.sh
Last active September 26, 2022 08:58
Compiling Eclair to WASM using walloc
#!/bin/bash
# This assumes eclair, clang and wasm-ld are installed,
# and that walloc (https://github.com/wingo/walloc) is compiled,
# and that walloc.o is copied to the current directory.
# Compiling (note: bulk memory needed for memset call)
eclair c program.eclair > program.ll
clang -DNDEBUG -Oz --target=wasm32 -mbulk-memory -nostdlib -c -o program.o program.ll
clang -DNDEBUG -Oz --target=wasm32 -mbulk-memory -nostdlib -c -o driver.o driver.c
@luc-tielen
luc-tielen / compile.sh
Created May 6, 2022 10:03
Eclair "hello world"
#!/bin/bash
clang-9 -g3 -O0 -o program main.c test.ll -Wno-override-module
@luc-tielen
luc-tielen / bf.ll
Created November 17, 2021 16:10
Demo of "Generating fast and expressive code using LLVM & Haskell" talk, extras
; ModuleID = 'bf'
source_filename = "<string>"
declare i8* @malloc(i32)
declare void @free(i8*)
declare void @llvm.memset.p0i8.i64(i8*, i8, i64, i1)
declare i32 @putchar(i32)
@luc-tielen
luc-tielen / BTree.hs
Created September 15, 2021 17:33
Playing around with types in llvm-hs
{-# LANGUAGE RecursiveDo #-}
module Eclair.Data.BTree
( Meta(..)
, SearchIndex
, SearchType(..)
, codegen
) where
import Protolude hiding ( Type, Meta )
@luc-tielen
luc-tielen / 1. Title
Last active November 26, 2020 16:24
souffle-haskell talk info
Leverage the power of logic programming with souffle-haskell
@luc-tielen
luc-tielen / Client.sh
Created August 1, 2019 17:07
Bash: run command passed via args on incoming connection
#!/bin/bash
nc -z 127.0.0.1 8421 &> /dev/null
@luc-tielen
luc-tielen / Bad.hs
Created June 16, 2019 11:41
MultiRec in combination with "Trees That Grow" approach
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Bad where
import Prelude
import Data.Kind ( Type )
import Generics.MultiRec.TH
### Keybase proof
I hereby claim:
* I am luc-tielen on github.
* I am luctielen (https://keybase.io/luctielen) on keybase.
* I have a public key ASBFC-6uqoyrwZEMgSfRJxpWTh-m1oQSQN68Fls0XF-7oAo
To claim this, I am signing this object: