Skip to content

Instantly share code, notes, and snippets.

View Mesabloo's full-sized avatar
🦐

Mesabloo Mesabloo

🦐
  • France
View GitHub Profile
@Mesabloo
Mesabloo / #Typechecker for QTT
Last active April 16, 2023 17:31
Implementing a typechecker for Quantitative Type Theory
This gist contains an implementation for a typechecker for Quantitative Type Theory (QTT), in Isabelle/HOL.
@Mesabloo
Mesabloo / #Closure Conversion and monomorphisation for QDTLC
Last active July 9, 2022 12:09
Closure conversion and monomorphisation by type erasure implemented on a Quantitative Dependently Typed Lambda Calculus.
Closure conversion and monomorphisation by type erasure implemented on a Quantitative Dependently Typed Lambda Calculus.
@Mesabloo
Mesabloo / #Typechecker for QDTLC
Last active August 5, 2023 16:56
A small typechecker using normalization by evaluation (NbE) for a Quantitative Dependently Typed Lambda Calculus (QDTLC).
A small typechecker using normalization by evaluation (NbE) for a Quantitative Dependently Typed Lambda Calculus (QDTLC).
@Mesabloo
Mesabloo / README.md
Last active June 2, 2022 15:00
A very simple VM (as a stack script) for a small concatenative programming language which aims to be as performant as possible.

Yes, this is very ugly. However, I managed to squeeze so much out of the original code, and make it really fast (though this could be even better). I think I might have gotten to the point where I cannot really make it go faster, but for a basic VM, I think this is bloody good as it is.

@Mesabloo
Mesabloo / Makefile
Last active August 10, 2021 13:55
In-design debugging PoC in Silice
.DEFAULT: main.ice
ifdef tool
silice-make.py -s main.ice -b $@ -p basic,pmod -o BUILD_$(subst :,_,$@) -t $(tool)
else
silice-make.py -s main.ice -b $@ -p basic,pmod -o BUILD_$(subst :,_,$@)
endif
clean:
rm -rf BUILD_*
@Mesabloo
Mesabloo / micro-interpreter.js
Last active January 5, 2021 21:48
A micro-intrepreter written in plain JavaScript.
/**
----------------------------------------------------------------
// Interpreter callstack
type CallStack = { vars: { name: string, value: Value }[] }[]
----------------------------------------------------------------
// A runtime value
type Value = Integer | Function | PrimFunction
type Integer = { type: 'Integer', value: int }
type Function = { type: 'Function', args: string[], block: ASTBlock }
type PrimFunction = { type: 'PrimFunction', val: (Value...) => Value }
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE NoStarIsType #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeOperators #-}
@Mesabloo
Mesabloo / Test.hs
Last active July 7, 2022 18:26
A simple exercise with Haskell and genericity
{-| Exercise:
- Step 1:
Write a program simulating an iterating machine: we for example feed a range
@[0..4]@ and an action @print@ and it must execute this action on all the
elements of the range.
Writing @iterate1 [4..9] print@ must output:
> 4
@Mesabloo
Mesabloo / main.py
Last active August 10, 2021 07:42
A messaging app-like bot, reordering the channels based on activity
from discord.ext import commands
import discord
import sqlite3
prefix = '#!'
client = commands.Bot(command_prefix=prefix)
print('Connecting to database...')
conn = sqlite3.connect('categories.db')
c = conn.cursor()
@Mesabloo
Mesabloo / LAM.hs
Created August 3, 2019 14:37 — forked from cheery/LAM.hs
Linear abstract machine interpreter steps in Haskell
-- The linear abstract machine
-- as described in the "The Linear Abstract Machine"
-- Environment is a representation of a canonical combinator
-- the canonical combinator u ⊗ v is represented by Ja, and 1 by Nil
-- the canonical combinator y ∘ v represented by Comb: y is piece of code.
--
-- Code is list of primitive instructions.
--
-- Sequential composition becomes concatenation (in opposite order),