Skip to content

Instantly share code, notes, and snippets.

@antonijn
antonijn / Program.aqua
Last active August 29, 2015 13:56
A bit of aqua, in various stages of its compilation.
import aqua.std;
public class Program
{
private static native int putchar(int ch);
private static void print(char ch)
{
putchar(ch);
}
getch:
peek64 0
peek64 8
peek64 16
peek64 24
dup abs(1)
deref64
dup abs(2)
ult
@antonijn
antonijn / hell0.asm
Last active August 29, 2015 13:56
hello
start:
load 5
ldip
add
jmp8 .0
raw64 13
raw "Hello, world!"
.0:
sys 1
retv
import aqua.std;
private class Program {
private static int getch(byte[] buf, ref int idx, ref int cp) {
int remunits;
byte nxt;
byte msk;
if (idx > buf.size()) {
return -1;
}
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.22 (GNU/Linux)
mQENBFMSGNEBCADUObN4T8VOelUIk0NIl5x68WX4VeFUeshCGAAmteh9qaGnWZQl
d/WtiXn7NHd8OJJNbae3oGxzcKwpKaHb/oqc7qa7Zke/ykvoVE0n3G4FHnWzOBY9
1JvC7tSzLHQCNpVZpSOXySSDlQ0Y8uOm0La6VWfDupWNGYcZnikIp5+/0NO0tSqO
9IrZ3fhhM+28PO9Cy4fBOVD5jCgYxdQSV+Dy9LB3/hDfbNxqflyEknsZ38K0C834
gqmf5Mk3cIVqh/3Veh+9fjySaeMeRtwDveImLSmwkE4jn6O6IcuHiLSnJbbm+ruZ
3SjFUBfWl/2KWSMBmSTPzCBfNm4w/CRgaCFJABEBAAG0NUFudG9uaWUgQmxvbSAo
TXkgZmlyc3QgR1BHIGtleSkgPGEuZC5ibG9tQHJ1Ymxvc2Eubmw+iQE/BBMBAgAp
.TH aquac 1 "March 2014" "" ""
.SH NAME
.P
aquac - The "official" compiler for the Aqua programming language
.SH SYNOPSIS
.P
.RB aquac\ [ \-CDLnstw ]
.RB [ \-a
.IR assembler ]
import aqua.std;
private class Program {
private static void main(String[] args) {
}
}
package my.pack;
public class MyClass {
public static boolean bar(final void() quux) {
return quux != null;
}
private static void main() {
bar(default(void()));
}
@antonijn
antonijn / MainClass.java
Last active August 29, 2015 13:57
Subtle differences
private static void foo() {
int x = 10;
void(int) f = void (int a) a = x;
}
private static void bar() {
final int x = 10;
void(int) f = void (int a) a = x;
}
@antonijn
antonijn / MainClass.java
Created March 16, 2014 10:41
Only two heap-allocations! Not bad!
private static void foo() {
byte b = 10;
short s = 10;
void() f = void () s = b;
void(int) g = void (int a) a = b;
}
private static void bar() {
final int x = 10;
void(int) f = void (int a) a = x;