Skip to content

Instantly share code, notes, and snippets.

View vlastachu's full-sized avatar

Vlad Chuprin vlastachu

View GitHub Profile
// http://ideone.com/ZmrJtE
#include <iostream>
#include <functional>
using namespace std;
using namespace std::placeholders;
template <typename A, typename B, typename C>
function<C(B)> operator^(A a, function<C(A,B)> fun){
// from https://news.ycombinator.com/item?id=8024116
function checkType(f) {
return function(a) {
var type = f.toString().match(/\/\/(.*)\n/)[1].trim();
if(type !== typeof(a)) throw new Error('Invalid type');
return f(a);
}
}
module Main where
import Text.ParserCombinators.Parsec
import Control.Applicative ((<*>), (*>), (<*), (<$>), pure)
import Data.Functor
import Data.List
data CompilerState = CompilerState { commands :: [VMCommand],
errors :: [String],
variables :: [(String, Int)] } --Map
deriving (Eq, Show)
#lang racket
(define operators (hash '+ 5 '- 5 '* 10 '/ 10))
(define (priority operator)
(hash-ref operators operator 0))
(define (operator? operator)
(hash-has-key? operators operator))
/*
* BakerMemoryManager.cpp
*
* Implementation of BakerMemoryManager class
*
* LLST (LLVM Smalltalk or Low Level Smalltalk) version 0.2
*
* LLST is
* Copyright (C) 2012-2013 by Dmitry Kashitsyn <korvin@deeptown.org>
* Copyright (C) 2012-2013 by Roman Proskuryakov <humbug@deeptown.org>