Skip to content

Instantly share code, notes, and snippets.

View forflo's full-sized avatar

Florian Mayer forflo

  • Erlangen, Germany
View GitHub Profile
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;
public class Mandelbrot {
private final int POISON_PILL = -42;
private final BlockingDeque<Integer> queue = new LinkedBlockingDeque<>();
public boolean [][] field;
Worker[] workers;
\documentclass{beamer}
\usepackage{tikz}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{courier}
\usepackage{amsmath}
\begin{document}
\tikzset{
import Data.Char
fix f = let x = f x in x
z = fix $ \z -> \f -> \la -> \lb ->
case (f, la, lb) of
(f, [], _) -> []
(f, _, []) -> []
(f, x:xs, y:ys) -> f x y : z f xs ys
@Override
public List<BFInstruction> visit(Instruction.Load load, Context context) {
LinkedList<BFInstruction> result = new LinkedList<>();
result.addAll(doComment(load.toString()));
final MemoryObject.Register target = load.target();
final MemoryObject.Register index = load.index();
final MemoryObject.Array array = load.array();
// make sure setup registers are zero
result.addAll(context.clearAndSetConstant(array.dataCellLocation(), 0L));
result.addAll(context.clearAndSetConstant(array.indexCellLocation(), 0L));
.globl main
main:
push %ebp
movl %esp, %ebp
push %ebx
sub $112, %esp
movl $72, -12(%ebp)
movl -12(%ebp), %ebx
#include <stdio.h>
#include <stdint.h>
int cmpLessThan(uint16_t a, uint16_t b) {
uint16_t c = 0;
uint16_t at = a;
uint16_t bt = b;
if (a==b) return 0;
while(at && bt) {
at--; bt--; c++;

Brainfuck Backend Notizen

Assembly der Art

P1: I1; I2; i3; Return P2: I1; I2; I3; ...; In; Return; ... Pn: I1; I2; I3; ...; In; Return; MAIN: I1; I2; I3; ...; In; Return;

Muss in ein While-Programm der folgenden Art umgebaut werden:

class Test {
static String mountain = "St. Helens";
static Test favorite() {
System.out.println("Mount ");
return null;
}
public static void main(String[] args){
System.out.println(favorite().mountain);
}
function t.forall(setPredicate, predicateGenerator)
return datatypes.Predicate(
function(node, parentStack, siblingStack, scopeStack)
return util.ifold(
util.imap(
util.imap(
util.imap(
astQuery(t._ast)
:starting(node)
:where(setPredicate)
function t.forall(setPredicate, predicateGenerator)
return datatypes.Predicate(
function(node, parentStack, siblingStack, scopeStack)
return util.ifold(
util.imap(
util.imap(
util.imap(
astQuery(t._ast)
:starting(node)
:where(setPredicate)