$ clang -v
clang version 3.0 (tags/RELEASE_30/final)
Target: i386-pc-linux-gnu
Thread model: posix
$ clang lambda_macro.c
$ ./a.out
lambda defined.
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
void int2str(long, char *); | |
int main(int argc, char *argv[]) | |
{ | |
long i = 12345; | |
char str[] = "00000\0"; |
(define (then m k) | |
(bind m (lambda (_) k))) | |
(define (state-unit a) | |
(lambda (s) `(,a ,s))) | |
(define (state-bind m k) | |
(lambda (s) | |
(let* { [r (m s)] | |
[a (car r)] |
$ clang -v
clang version 3.0 (tags/RELEASE_30/final)
Target: i386-pc-linux-gnu
Thread model: posix
$ clang lambda_macro.c
$ ./a.out
lambda defined.
Sphinx はドキュメントを作成するツールで, Pygments は Sphinx 内部で使われているシンタックスハイライタです.
Pygments を使用して独自のハイライティングをする方法は, チュートリアルあるいはソースコードを読むのがいちばん手っ取り 早いでしょう. http://pygments.org/docs/lexerdevelopment/ とか, https://bitbucket.org/birkenfeld/pygments-main/src/0442d3cf660124048efde3c0d72ff79ea0355040/pygments/lexers?at=default などを読めば,レクサをつくってシンタックスハイライタをつくる方法が
# -*- coding: utf-8 -*- | |
# Rubyだったら正規表現はすごい簡単だよ!!! | |
# 他の言語ではいくつかパターンがありますが、自分はRubyほど楽に正規表現を利用できる言語を知りません。 | |
msg = "まなさん大好き" | |
# Ruby では正規表現リテラルがあります。 | |
# // のリテラルはそれだけで正規表現のリテラルです | |
# かなりperl的なのです^q^ |
{-# LANGUAGE TemplateHaskell #-} | |
import Control.Lens | |
import Control.Monad.Trans | |
import Control.Monad.State | |
import Data.Maybe | |
data Instr = Access Int | |
| Closure Code | |
| Apply |
# -*- coding: utf-8 -*- | |
# importas は Python で言う import MyClass as RenamedMyClass 的なことをできます | |
# importas Namespace::MyClass, :RenamedMyClass とします | |
def importas(from, to_name) | |
Kernel.const_set(to_name, from) | |
end | |
=begin | |
module Namespace | |
class File; end |
import itertools | |
# このへん参考: http://kk6.hateblo.jp/entry/20110521/1305984781 | |
# zip_longest はもっとも長いイテレータに合わせて繰り返す | |
# 終わったイテレータには None が入る | |
# [('a', 1), ('b', 2), ('c', None), ('d', None), ('e', None), ('f', None)] | |
print([(char, n) for char, n in itertools.zip_longest("abcdef", range(1, 3))]) | |
# [(1, 'a'), (2, 'b'), (None, 'c'), (None, 'd'), (None, 'e'), (None, 'f')] |
たぶん Mountain Lion でしか動きません。自分の環境でしかテストしてない
compile:
$ as -o brainfuck.o brainfuck.s && ld -o brainfuck -e main brainfuck.o
run:
$ ./brainfuck -e "+++++++++[>++++++++>+++++++++++>+++++<<<-]>.>++.+++++++..+++.>-.------------.<++++++++.--------.+++.------.--------.>+."