Skip to content

Instantly share code, notes, and snippets.

@pandaman64
pandaman64 / .vimrc
Created March 12, 2014 14:51
.vimrc from my Cygwin environment
set nocompatible
"---------------------------------------------------------------------------
" 検索の挙動に関する設定:
"
" 検索時に大文字小文字を無視 (noignorecase:無視しない)
set ignorecase
" 大文字小文字の両方が含まれている場合は大文字小文字を区別
set smartcase
import std.typecons;
import std.traits;
import std.stdio;
auto tupleAccumlate(Func,First,Types...)(Func func,First first,Types args){
static if(args.length > 0){
return tupleAccumlate(func,func(first,args[0]),args[1..$]);
}
else{
// ==UserScript==
// @name Into Wandbox
// @namespace https://twitter.com/__pandaman64__
// @include *
// ==/UserScript==
(function(){
function into_wandbox(str){
//Remove NBSPs
var new_str = str.replace(/\u00A0/gi, ' ');
#include <type_traits>
#include <tuple>
#include <cstddef>
#include <string>
#include <iostream>
template<std::size_t ...Indices>
struct index_tuple{
constexpr index_tuple(){}
constexpr static index_tuple make(){
@pandaman64
pandaman64 / from_tuple.cpp
Created April 1, 2013 13:08
construct unnamed struct from tuple.
#include <type_traits>
#include <tuple>
#include <cstddef>
#include <string>
#include <iostream>
template<std::size_t ...Indices>
struct index_tuple{
constexpr index_tuple(){}
constexpr static index_tuple make(){
@pandaman64
pandaman64 / Grammar.txt
Created February 4, 2017 09:57
MyML Grammar
// '\'はPEGの分岐,'?'はオプショナル, '*'は0回以上の繰り返し
Expr := LetRec \ Let \ If \ Literal \ Apply \ Identifier
LetRec := "let rec" Identifier Identifier? "=" Expr "in" Expr
Let := "let" Identifier Identifier? "=" Expr "in" Expr
If := "if" Expr "then" Expr "else" Expr
Literal := ライブラリの整数パースする奴使ってる
Apply := Value Value*
Value := "(" Expr ")" \ Primitive
Primitive := LetRec \ Let \ If \ Literal \ Ident // <- Apply := Expr Expr* ってするとApplyが左再帰するのでこんなんやってる
Identifier := [a-zA-Z] [a-zA-Z0-9!?]* (但し予約語ではない)
@pandaman64
pandaman64 / design.md
Last active February 8, 2017 15:16
Yet Another CPU

CPU Architecture

  • stack machine
  • 1 word = 8 bit
  • instruction length = 1 word
  • variable CPI(clocks per instruction)
    • stack operation -> 1 clock
    • immediate operation -> 2 clocks

Instructions

Overview

@pandaman64
pandaman64 / key
Last active April 20, 2017 07:42
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDwkeLXbdy+pMEtzZ2DiL3jRHWcpsmauAreUBiBYkh0nIbKimFXK45x0t+P7iGi0IUHzKsaseiPCUYBTlljtz/AJRS57E3FiA91foqUWagotIS9+PYbHd9fpoykdc3hZK7g9wLtNQihLERKRi/xfMIbgD5rfnNyK9Xs7owwW5b2DqNUWpbxGgiY5mywRsbQ7c+qFX8W2aAv4Yib5TTNRHaCANGXt9vRJTF7/WwMVydF/1lEIW6RgsJDMOSmJLpFVpIE28x+N1OJZcIWEdB/i4HtXAhPo9M0pWjsxji2FQkb6X1qJSVZTD+cXvoznlQozSDyMvQKuGNToWPZ/zeJCQZNKfqn3kxnsXuoJbbrgE/uE8enTD+nlpuRW+rg1FpeQBIDN5LIklAhlGJJAQVoXhIX/G4tS/cywBPQcxUFowJkKhevKKDVupvBJIxs4PEkPXO7AzRY3261Rbnekg5mym8DM15G50N92wFeBAA09JzuweHxkfZ+a2MdaQB2MKzAbUVaYn04Dw5M4W3O/OnfvG6FwDy6ucTSl/asYqoH6YooURh2gZ8QnD3XkWk4rcGccfEZlFZE0cxyK52MbmDMUrwL8PN161glExQdp2DUVhaRcRQAQpX65v0PDctIKmoAdzYT/QSxv4TE43reNyCFeJIaGxKsWieUSDpUsd0jx8Afmw== panlap@pan-laptop
L4:
MV r2,r6
MV r1,r6
ADDI r1,128
ST r1,r2
ADDI r6,128
MV r1,r4
MV r0,r0
ST r1,r0
MV r0,r4
"dein Scripts-----------------------------
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=/home/pan/.vim/bundles/repos/github.com/Shougo/dein.vim
" Required:
if dein#load_state('/home/pan/.vim/bundles')