Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
mv {C,Golang}- Perl1.0
Search
AnaTofuZ
January 26, 2019
Technology
0
810
mv {C,Golang}- Perl1.0
YAPC::Tokyo 2019のLTです
AnaTofuZ
January 26, 2019
Tweet
Share
More Decks by AnaTofuZ
See All by AnaTofuZ
k1LoW/deckのすすめ
anatofuz
0
370
Perl1.0 Deep Drive 0.01
anatofuz
0
170
Rubyの国のPerlMonger
anatofuz
3
1.2k
Pythonで爆速でHello, World!する
anatofuz
0
93
思いつきで推しの誕生日記念コンテンツを2日で作る技術
anatofuz
0
150
AWSで雰囲気でつくる! VRChatの写真変換ピタゴラスイッチ
anatofuz
0
410
令和最新版 Perlコーディングガイド
anatofuz
5
7.8k
rakulangで実装する! RubyVM
anatofuz
6
4.4k
沖縄の大学で育った学生がエンジニアになるまで
anatofuz
2
6.3k
Other Decks in Technology
See All in Technology
Redshift認可、アップデートでどう変わった?
handy
1
110
アプリにAIを正しく組み込むための アーキテクチャ── 国産LLMの現実と実践
kohju
0
250
AgentCoreとStrandsで社内d払いナレッジボットを作った話
motojimayu
1
1.1k
AWSインフルエンサーへの道 / load of AWS Influencer
whisaiyo
0
240
ペアーズにおけるAIエージェント 基盤とText to SQLツールの紹介
hisamouna
2
1.9k
戰略轉變:從建構 AI 代理人到發展可擴展的技能生態系統
appleboy
0
140
コールドスタンバイ構成でCDは可能か
hiramax
0
120
202512_AIoT.pdf
iotcomjpadmin
0
150
SQLだけでマイグレーションしたい!
makki_d
0
1.2k
2025-12-27 Claude CodeでPRレビュー対応を効率化する@機械学習社会実装勉強会第54回
nakamasato
4
1.2k
Claude Codeを使った情報整理術
knishioka
14
11k
ハッカソンから社内プロダクトへ AIエージェント「ko☆shi」開発で学んだ4つの重要要素
sonoda_mj
6
1.8k
Featured
See All Featured
A Soul's Torment
seathinner
1
2k
What's in a price? How to price your products and services
michaelherold
246
13k
Utilizing Notion as your number one productivity tool
mfonobong
2
190
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
32
Thoughts on Productivity
jonyablonski
73
5k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
1
210
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
150
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.7k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
The Limits of Empathy - UXLibs8
cassininazir
1
190
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
590
Transcript
͏ݟͨ!!! id:AnaTofuZ
• 最近Perl1.0とPerl6の処理系を書きます • 「Perl1.0を触っている」と人々に言うと…
Perl1.0 • 「古い」 • 「化石」 • 「それ使ってて何の意味あるのw」 • 「そんなことよりLisp」 •
「いいから卒論」
Ұपճͬͯ৽͍͠ ݹ͍
Perl1.0 • Perl1.0はemacsより新しいのに….(発表年的な意味で)
Perl1.0 • Perl1.0はemacsより新しいのに….(発表年的な意味で)
Perl1.0 • Perl1.0はemacsより新しいのに….(発表年的な意味で) •古めのCで書かれている から古いと思われるや!!!!
ΑΖ͍͠ ͳΒ
None
mv {C,Golang}- Perl1.0 八雲アナグラ @AnaTofuZ YAPC::Tokyo 2019
Cで書かれたPerl1.0を golangで 書き直していくぞ!!!!
Perl1.0 C Yacc Configure Makefile 字句解析/ おおよその処理 構文解析 ビルド周り オリジナル
Perl1.0 C Yacc Configure Makefile 字句解析/ おおよその処理 構文解析 ビルド周り オリジナル
Go goyacc golang Go
Ͱ͖ͦ͏ͳงғؾ
rewriting Perl1.0 • Perl1.0そこそこ書かれている(まぁプログラミング言語だし…) • 全部書き直すのは可能であると思うが,いきなりは厳しい • 戦略として適当なサンプルプログラムを用意し, gdb/lldbで元のPerl1.0をトレースしつつ そのPerlプログラムの実行で
使う関数と構造体をその都度実装していく
• c2goとかいうCをgoに変換してくれるツールも ありますが… • 使ってみたらエラー吐いて変換できなかった
Perl1.0 • golangでポインタ演算は厳しい(unsafeを使えば出来る?)が Perl1.0はポインタ演算や, アドレス参照をしまくっている • 単一の構造体のポインタを返しているだけかと思いきや, 同じ関数で構造体のリストをポインタ演算して作っている • yaccのデバッグトレースに対する知見があまりない
Perl1.0 • 無駄な処理がある (初期値をいれて構造体を作った次の行で書き換えるなど) • 構造体の名前が良くわからない (なんでこんな名前にしたんだ……) • char型の下位ビットなどをフラグにしている
(goへの移植時にいろいろと考える必要がある) • 実装の解説資料が無い • ラベルgoto多用
Perl1.0 • 言うほどマクロ使ってない • 一人の人間が理解できそうな気がするコード量 • 気合いれれば結構読める処理が多い • ラリー・ウォールが書いたコードが読める!! •
golangへの変換でCとgolangの勉強になる
• 一週間でスカラ変数の代入と出力をしたかったが厳しかった • スカラ変数の代入と出力で利用するYACCの要素 レキサーの中で使用する関数は実装した • 愚直に使うコードを移植していてPerl1の雰囲気がわかってきた • 年内には作れそう!!
goPerl1.0 • これからのgoPerl1.0にご期待下さい! (進捗報告はOkinawa.pmで!!!) • https://github.com/AnaTofuZ/Go-Perl1