Skip to content

Instantly share code, notes, and snippets.

View t-sin's full-sized avatar
🆑

Shinichi Tanaka t-sin

🆑
View GitHub Profile
@ofan
ofan / lisp.cpp
Last active April 11, 2024 11:28
Lisp interpreter in 90 lines of C++
Lisp interpreter in 90 lines of C++
I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second.
Just for fun I wondered if I could write one in C++. My goals would be
1. A Lisp interpreter that would complete Peter's Lis.py test cases correctly...
2. ...in no more than 90 lines of C++.
Although I've been thinking about this for a few weeks, as I write this I have not written a line of the code. I'm pretty sure I will achieve 1, and 2 will be... a piece of cake!
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(defvar *filters* '(/line))
(defvar *results* '())
(defun /line (output error)
(values
@tani
tani / bfc.ros
Created June 24, 2017 04:52
brainf*ck compiler
#!/bin/sh
#|-*- mode:lisp -*-|#
#| <Put a one-line description here>
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
(ros:ensure-asdf)
;;#+quicklisp (ql:quickload '() :silent t)
)
@tenpoku1000
tenpoku1000 / AC_2017-12-06.md
Last active May 10, 2024 17:18
自作 OS の GUI 開発のためのメモ

自作 OS の GUI 開発のためのメモ

2024/04/20 更新

この記事は、自作OS Advent Calendar 2017の 12/6 の記事として書かれました。

主に、ライブラリや仕様書のダウンロード・サイトやリポジトリなどの URL を集めてみました。この他の URL は、以下でブックマークを公開していますので、興味がある方は参照してみてください。

@tenpoku1000
tenpoku1000 / AC_2017-12-04.md
Last active May 1, 2024 07:52
自作派の人のためのコンパイラ関連規格のメモ

自作派の人のためのコンパイラ関連規格のメモ

2024/05/01 更新

この記事は、自作OS Advent Calendar 2017の 12/4 の記事として書かれました。C 言語と JavaScript、それに両者を繋ぐ役割を持つ Web IDL についてのメモです。

主に、仕様書のダウンロード・サイトなどの URL を集めてみました。この他の URL は、以下でブックマークを公開していますので、興味がある方は参照してみてください。

@y2q-actionman
y2q-actionman / a_road_to_common_lisp_jp.md
Last active May 30, 2024 05:16
A Road to Common Lisp 翻訳

この文章は、 Steve Losh 氏の記事 "A Road to Common Lisp" の翻訳です。

原文はこちらです: http://stevelosh.com/blog/2018/08/a-road-to-common-lisp/


A Road to Common Lisp (Common Lisp への道)

これまで、「最近のCommon Lispをどう学ぶとよいでしょう?」と助言を求めるメールをたくさん受け取ってきました。そこで私は、これまでメールやソーシャルメディアに投稿した全てのアドバイスを書き下すことにしました。これが誰かに有益ならば幸いです。

#|
$ cat test.f
#!forth
: <= over over < rot swap = or ;
: fib dup 0 swap <= if drop 0 else dup 1 = if drop 1 else
dup 1 swap - fib swap 2 swap - fib + then then ;
10 fib
$ ros run -l uf-reader.lisp -l test.f -q
|#
(require 'uf)
@fal-works
fal-works / 弾幕仮想機械メモ
Last active April 3, 2019 09:57
弾幕仮想機械メモ
// 命令セット一覧(2019-04-03)
// 命名規則が揺れている……
END // 実行終了。以降、速度などそのままに動き続ける
VANISH // バイトコードを動かしているActor(敵や弾丸の総称)自体を消して終了
// スタック操作系
PUSH_8
PUSH_16
PUSH_32
@greymd
greymd / yamaya_fib.md
Last active February 20, 2023 08:12
yamayaさんの難読化シェル芸(フィボナッチ数列) 解説

yamayaさんの難読化シェル芸(フィボナッチ数列) 解説

経緯

(1) ある日、yamaya さんという怖い方がこのツイートを投稿する。

yamaya_src

@carrotflakes
carrotflakes / echo-bot.lisp
Created April 10, 2019 13:07
echo bot on twitter in Common Lisp
(ql:quickload :chirp)
(setf chirp:*oauth-api-key* "Put"
chirp:*oauth-api-secret* "your"
chirp:*oauth-access-token* "credencials"
chirp:*oauth-access-secret* "here!")
(print (chirp:account/verify-credentials))
(defun status-text-without-mention (status)