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
:- op(1200, xfx, ::-). | |
:- op( 30, fx, ^). | |
term_expansion(Head ::- Body0, Head :- Body1) :- | |
func_style(Body0, Body1). | |
replace_hats(X, X, Vars, Vars, (Z,Z)) :- var(X), !. | |
replace_hats(**, V, [V|Vars], Vars, (Z,Z)) :- !. | |
replace_hats(^X, V, Vars1, Vars2, ([P|Preds],Z)) :- !, | |
replace_hats(X, P, [V|Vars1], Vars2, (Preds,Z)). |
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
# coding: utf-8 | |
require "strscan" | |
require "set" | |
# HTMLを解析する | |
class RjStAX | |
attr_reader :scan, :node, :name, :attrs, :text |
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
#include <iostream> | |
struct SecretLove | |
{ | |
SecretLove(const std::string &msg) | |
:msg_4_u(msg) | |
{ | |
} | |
private: |
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 "strscan" | |
require "pp" | |
## | |
## Alインタープリター | |
## | |
# codes | |
AlFail = Object.new |
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
bf_memget([K:X|_], K, V) :- !, X = V. | |
bf_memget([ _|T], K, V) :- !, bf_memget(T, K, V). | |
bf_memget([], _, 0). | |
bf_memset([K:V|T], [K:_|T], K, V) :- !. | |
bf_memset([ H|U], [ H|T], K, V) :- !, bf_memset(U, T, K, V). | |
bf_memset([K:V], _, K, V). | |
bf_exec([], _, _) :- !. |
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
package jp.segfault.scala.util | |
import scala.util.parsing.combinator._ | |
/** | |
* Parser combinator for Operator-precedence parser(http://en.wikipedia.org/wiki/Operator-precedence_parser). | |
*/ | |
trait OperatorPrecedenceParsers extends Parsers { | |
trait Op[+T,U] { |
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
import java.lang.reflect.{Proxy, InvocationHandler, Method} | |
object Prototype { | |
def clone[T](base:T, content:AnyRef)(implicit manifest:ClassManifest[T]):T = { | |
val metaclass = manifest.erasure | |
Proxy.newProxyInstance(metaclass.getClassLoader, Array(metaclass), | |
new InvocationHandler { | |
override def invoke(proxy:Object, method:Method, args:Array[Object]):Object = { |
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
brainfuck_run Script :- next(Script, "", "0", ""). | |
error Msg :- puts("Error: !$Msg!\n"), halt. | |
inc {(?<I>.*)0$}, Res :- !, Res = "${I}1". | |
inc {(?<I>.*)1$}, Res :- !, inc(I, J), Res = "${J}0". | |
inc X, "1" :- !. | |
dec A, C :- dec0(A, B), B = {^0*(?<C>.+)}. | |
dec0 {(?<I>.*)1$}, Res :- !, Res = "${I}0". |
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
// programmed by hisui(https://github.com/hisui) | |
/** | |
* | |
* jitexpr は簡易言語のJITコンパイラー方式の言語処理系です | |
* | |
* スクリプトの記述例: | |
* def fib(n) { | |
* if(n < 3) 1 else fib(n-1) + fib(n-2); | |
* } | |
* i = 0; |
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
// build: g++ tetris.cpp -o tetris.exe gdi32.dll -Xlinker --enable-stdcall-fixup | |
#include <windows.h> | |
#include <time.h> | |
#include <algorithm> | |
#include <stdexcept> | |
static const int CELL_DIM_X = 17; | |
static const int CELL_DIM_Y = 17; |
OlderNewer