第一回 簡易PostScriptインタプリタを作ろう やる事 ハッシュ、線形リスト、スタックの実装 簡単なインタープリタの実装 言語はPostScriptのサブセット 実行可能配列(関数リテラル相当)、ifelse、repeatくらいまで 3000行くらい。 PostScriptのサブセットを実装してみたいと思います。 最初はForthを実装しようとしたのですが、制御構造の実装がやや面倒なので、 その辺がよりシンプルで美しいPostScriptに変更します。(その歴史的な理由でフォルダ名などはforth_modokiになっています。すみません)。 PostScriptは触るとすぐわかるけど説明するとややこしい言語仕様なので、作りながら言語仕様自体の説明はしていきます。 なお、PostScriptは全く知らなくてもOKです。 この回の狙い 簡単なパーサーの書き方を学ぶ 言語の処理系を実装する
Ever wanted to make your own programming language or wondered how they are designed and built? If so, this book is for you. Crafting Interpreters contains everything you need to implement a full-featured, efficient scripting language. You’ll learn both high-level concepts around parsing and semantics and gritty details like bytecode representation and garbage collection. Your brain will light up w
あけましておめでとうございます。今年もよろしくおねがいします。艮鮟鱇です。 さてつい先程、友人から「冬休みに言語処理系ちょっと書いてみたいんだけどいい資料ない?」(意訳)と言われました。新しい年も始まりましたし、これを機にコンパイラ・インタプリタを書き始める人も少なくないこともないかもしれません。 ということで私が把握している言語処理系開発のための資料を以下に一覧します。上から順に見ていって、自分に合うものを探して頂ければと思います。私がよく知っているものを並べたので、全体的にCコンパイラよりです。「自分が開発するときに見るやつが載ってない!」という方は是非コメントをくださるか、 Twitterで雑にリプライをお願いします。 低レイヤを知りたい人のためのCコンパイラ作成入門セキュキャン2018 Cコンパイラ開発ゼミの講師の一人、Rui UeyamaさんのCコンパイラ作成入門資料です。タイト
私は時折、コーディングに対する考え方を変えさせられるような、従来と非常に異なるプログラミング言語に出会います。本記事では、その中でも特に気に入っている発見をいくつかご紹介したいと思います。 これは、先賢による「関数型プログラミングは世界を変える!」的な投稿ではありません。本記事で挙げるのは、もっと「知る人ぞ知る」的なリストです。多くの読者の方にとって、以下の言語やパラダイムは聞いたことのないものが大半だと思いますので、私が経験したように、これらの新しい概念を学ぶ楽しさを感じていただければ幸いです。 注:私は以下の言語の多くに関して最低限の経験しかありません。その発想に引き込まれたのであって、専門的知識は持ち合わせていないため、訂正すべき点や誤りがあればどうぞご指摘ください。また、本記事で取り上げていない新しいパラダイムや概念に出会った方は、ぜひお知らせください。 最新情報:本記事が r/p
はじめに このオンラインブックは執筆中です。完成版ではありません。フィードバックフォーム この本には一冊の本に盛り込むにはやや欲張りな内容を詰め込みました。本書では、C言語で書かれたソースコードをアセンブリ言語に変換するプログラム、つまりCコンパイラを作成します。コンパイラそのものもCを使って開発します。当面の目標はセルフホスト、すなわち自作コンパイラでそれ自身のソースコードをコンパイルできるようにすることです。 この本では、コンパイラの説明の難易度が急に上がりすぎないように、様々なトピックを本書全体を通じて次第に掘り下げていくという形で説明することにしました。その理由は次のとおりです。 コンパイラは、構文解析、中間パス、コード生成といった複数のステージに概念的に分割することができます。よくある教科書的アプローチでは、それぞれのトピックについて章を立てて解説を行うことになりますが、そのよう
東大CPU実験でUnixが動かせるCPUを自作してxv6 Unixを移植した件について話を伺いました。出演者: ぬるぽへ (@nullpo_head)、Rui Ueyama (@rui314) https://turingcomplete.fm/9 ハッシュタグは#tcfmです。 TCFMはサポーターの投げ銭によって収益を上げています。このコンテンツに課金してもいいよという方はぜひクリエイター支援サイトPatreonから登録してご協力ください。 イントロ (0:00) 日本語プログラミング言語 (1:16) 品川研 (2:41) 東大CPU実験の紹介 (4:38) 使っているハードウェアは結構よい (14:30) 情報理論、可逆計算、情報と熱 (16:20) CPU実験道場破り (18:55) 汎用CPUを作る必要はあるのか? (19:55) xv6は昔のUnix v6のテイストをそのまま
はじめに これは「言語実装 Advent Calendar 2017」24日目の記事です。 この記事では 64bit版Windows で実行可能な x86_64 のセルフホスティング Forth コンパイラを作ります。 対象読者としては「C言語そこそこわかる」「x64アセンブラに嫌悪感はない」ぐらいの人を想定しています。コンパイラの知識は特に前提としません。 完成品はこちらから取得できます。 bootstrap には C を使います。しかしC言語的にお行儀の悪いことを色々やりますので、バージョンやコンパイルオプション等によっては動かないかもしれません。ご了承ください。一応完成版は以下の環境で動作を確認しています。 Cygwin64 の gcc option: -O3 と -O なし両方 version: 6.4.0 (GCC) target: x86_64-pc-cygwin Msys2
先週Microsoft社がP言語に関するブログ記事を公開し一部界隈で話題となった。 P言語くん pic.twitter.com/uULzxIO4ct— Kuntaro Ishiyama (@_iamkuntao) 2017年3月26日 「いまさら一文字言語かよ…」「何個目だ?」といった批判的諦念的なものから、「RustとGoとErlangの間の子みたいなのだなあ」「なんか読みにくい」といった反応が多くこの言語の重要性やインパクトに対して正しく理解しているものがあまりなかった。尊敬しているTD勢ですらあまり重要性が伝わってないようだ 1 2 。上記のブログ記事を読んだり、マニュアルを読んだらすぐ分かるようなことではあるが、日本語で解説しておこうと思う。なおいわゆる言語入門とかそういった類のものではないことをご理解いただきたい。 TL;DR 並行処理や分散システムの形式証明や形式検証はそれ自体
Creating Languages in Racket Sometimes you just have to make a better mousetrap. Matthew Flatt, University of Utah Choosing the right tool for a simple job is easy: a screwdriver is usually the best option when you need to change the battery in a toy, and grep is the obvious choice to check for a word in a text document. For more complex tasks, the choice of tool is rarely so straightforward—all t
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く