This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Control.Applicative ((<|>)) | |
import qualified Data.SCargot as SCargot | |
import qualified Data.SCargot.Language.Basic as SCargot | |
import Data.SCargot.Repr.Basic | |
import Data.Text (Text) | |
import qualified Text.Parsec as Parsec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(unboxed_closures)] | |
#![feature(core)] | |
#![feature(io)] | |
use std::old_io::stdio::{stdin}; | |
use std::collections::HashMap; | |
// This is our toy state example. | |
#[derive(Debug)] | |
struct State { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
require 'set' | |
module Tokile | |
YELLOW = "\x1b[33m" | |
GREEN = "\x1b[32m" | |
CLEAR = "\x1b[39m" | |
UP = "\033[F" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
import Data.Map.Strict (Map) | |
import qualified Data.Map.Strict as M | |
import MonadLib | |
type Tables t a = (PrefixMap t a, InfixMap t a) | |
newtype PrattM t r a = PrattM | |
{ runPrattM :: ReaderT (Tables t r) (StateT [t] (ExceptionT String Id)) a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CPPFLAGS = -std=c++1z -fmodules-ts | |
ALL: main | |
main: speech.o main.cc | |
clang++ $(CPPFLAGS) -fprebuilt-module-path=. -o $@ $^ | |
speech.o: speech.pcm | |
clang++ $(CPPFLAGS) -o $@ -c $< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug)] | |
enum Expr { | |
Var { x: u32 }, | |
App { f: ExprRef, arg: ExprRef }, | |
Lam { body: ExprRef }, | |
} | |
use Expr::*; | |
#[derive(Debug, Copy, Clone)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
-- WARNING! This is very bad, quickly-written code, and should not be | |
-- trusted to do anything right! It does not support writing, and still | |
-- has several problems even for reading. Also it's ugly and bad. | |
import qualified Data.ByteString as BSS | |
import Data.ByteString.Lazy (ByteString) | |
import qualified Data.ByteString.Lazy as BS | |
import Data.Char (isDigit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A basic intepreter for the untyped lambda calculus | |
enum Term | |
{ Num(int) | |
, Var(~str) | |
, Lam(~str, ~Term) | |
, App(~Term, ~Term) | |
, Let(~str, ~Term, ~Term) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This is a naive implementation of Jonathan McCabe's elaboration of | |
* Alan Turing's model of morphogenesis, as described here: | |
* http://www.jonathanmccabe.com/Cyclic_Symmetric_Multi-Scale_Turing_Patterns.pdf | |
*/ | |
extern crate rand; | |
use rand::Rng; | |
use std::env; | |
use std::io::Write; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main: libsample.a | |
gcc -lpthread -ldl main.c libsample.a -o main | |
libsample.a: sample.rs | |
rustc --crate-type=staticlib sample.rs | |
clean: | |
rm -f main libsample.a |
NewerOlder