Skip to content

Instantly share code, notes, and snippets.

@Tpaefawzen
Tpaefawzen / Makefile
Last active March 7, 2026 10:14
Partly Deobfuscated IOCCC 2019/lynn: Compiler and Runtime for Haskell Subset
%.c: %.hs
( ../prog < $<; cat ../prog.c) > $@ || (rm $@; false)
@Tpaefawzen
Tpaefawzen / Synopsis.md.
Created February 19, 2026 13:01
Use array of jmp_buf and setjmp() and longjmp() for error handing
## Synopsis
./hello [-g] [-n num_repeats] [Args ...]
@Tpaefawzen
Tpaefawzen / README.md
Last active February 18, 2026 11:29
Wip: implement Grass (Ueno, 2006) without pushing global and local values to data stack

How I want to implement Data

Each data is represented as unsigned integer. 0-255 as such Byte, 256 as I, 257 as K, 258 as KI, 259 as read, 260 as next, 261 as out, n>=262 if n is even as N-th code, else n is odd as N-th previous item on data stack.

Alternative

n>=262 where

@Tpaefawzen
Tpaefawzen / 20250729--grass.txt
Created July 29, 2025 09:16
Idea of compiling Grass esolang
T is unsigned integers type
Program ::= /* */ | Program Cmd
Var = Local T | Param T | Globl T | Wtf
App = [2]Var
Abs = struct { args: T; len: T; body: [len]App; }
Cmd = App | Abs
In var union, T indicates 0-indexed variable index
@Tpaefawzen
Tpaefawzen / 34-asm.c
Created July 26, 2025 08:03
Inline assembly for AArch64 in C program when you want to call system call on Linux
static
long long os_write(long long fd, void *buf, long long len) {
register long long x0 __asm__("x0") = fd;
register long long x1 __asm__("x1") = (long long)buf;
register long long x2 __asm__("x2") = len;
register long long x8 __asm__("x8") = 64;
__asm__ volatile (
"svc 0"
: "+r"(x0)
: "r"(x1), "r"(x2), "r"(x8)
@Tpaefawzen
Tpaefawzen / README.md
Created May 15, 2025 11:47
The UNBAPTIZED programming language implementation in Python 3
.Dd May 25, 2023
.Dt CONVX2J.SH 1
.Os ShellShoccar-jpn/Parsrs
.
.Sh 名前
.Nm convx2j.sh
.Nd XPath-valueテキストをJSONPath-valueに変換
.
.Sh 書式
.Nm
@Tpaefawzen
Tpaefawzen / malbolge.zig
Created May 11, 2025 06:14
Ben Olmstead's Malbolge language (1998) implementation in Zig language; kinda translated C implementation into Zig
const std = @import("std");
pub const xlat1 =
"+b(29e*j1VMEKLyC})8&m#~W>qxdRp0wkrUo[D7,XTcA\"lI"
++ ".v%{gJh4G\\-=O@5`_3i<?Z';FNQuY]szf$!BS/|t:Pn6^Ha";
pub const xlat2 =
"5z]&gqtyfr$(we4{WP)H-Zn,[%\\3dL+Q;>U!pJS72FhOA1C"
++ "B6v^=I_0/8|jsb9m<.TVac`uY*MK'X~xDl}REokN:#?G\"i@";
pub fn main() !void {
@Tpaefawzen
Tpaefawzen / DisMath.lua
Created February 17, 2025 09:04
Lua library to implement some arithmetic things for esoteric programming language Dis
return function(base, digits)
local t = {
base = base;
digits = digits;
End = base ^ digits;
Max = base^digits - 1;
};
function t.is_representable(x) return 0<=x and x<=t.Max end
This file has been truncated, but you can view the full file.
}_>_{|^>|!|||^^}|{*!}|^{^{{>_}*|*_}|^}|*_}*!|{|*{^^|>!}}_*^}}^^{*>
*__>__{|!!!^>*^^_!_>|^*}**|{!}|^*{^}!{!*>^!_}{}^>!^|*!*_*{}|>^*^!|
!|*|>>>{_{}{}_}{|*}|}|!_}|*>|^}^^>!|>!|{*{|*{}|^>_|^^>}|^{_!*!!>|*{*
}^{!}_}|{|>__*!_*_**{>{_}{{!}_}*^{**{|>>>**>*>>>{}>^|*|_}^!|*_{{|{{_
{^>!{>>>}*|^^>_>{{!}**>|_}_*^^^|||_{{!{>}*|_}|{^!_>^|*{>||^!*|__>{_{>
*_!}_}!*|*>!!*{>*}||>^}_{*>}*>^_^|||*^!_!_*>^{!^}>|**|!*_!_*!!^_}^>_|
{*_}*!^_}!*|!|*{{_>{|}*{|}_*|{{!_>_}{{!{|!||}|_*_|{*^}!!>*!|}_>*^|!*^
}{|{_|}^>|}*!_*{_*^{|^||^}>!!^>^|}>||*{_{}>>^>|!^|^!{!_!*^*|}_^!{!}>{_
}}{>!*!^>|_>_^*^_^>^_!*{_}}!*{_^}{!_{_}}>^||_*|}!^!|!!>>|^^>*^!**_}^!|
{}}*!^}_*_}>|*|*|>|_>}*!_!*_!|^!^>}!>{!|{{^*}{|>|}*!^^>!*!}>!_||!_}}>{^