Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
mv {C,Golang}- Perl1.0
Search
AnaTofuZ
January 26, 2019
Technology
890
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
mv {C,Golang}- Perl1.0
YAPC::Tokyo 2019のLTです
AnaTofuZ
January 26, 2019
More Decks by AnaTofuZ
See All by AnaTofuZ
Perl GraphQL 高速化バトル 2026年5月版
anatofuz
0
95
k1LoW/deckのすすめ
anatofuz
2
860
Perl1.0 Deep Drive 0.01
anatofuz
0
260
Rubyの国のPerlMonger
anatofuz
3
2.7k
Pythonで爆速でHello, World!する
anatofuz
0
150
思いつきで推しの誕生日記念コンテンツを2日で作る技術
anatofuz
0
220
AWSで雰囲気でつくる! VRChatの写真変換ピタゴラスイッチ
anatofuz
0
590
令和最新版 Perlコーディングガイド
anatofuz
5
11k
rakulangで実装する! RubyVM
anatofuz
6
6.4k
Other Decks in Technology
See All in Technology
「作れる」と「リリースできる」の間にあったもの── PdMを外して見えた、PdMがやるべき仕事/Buildable ≠ Shippable: What Removing the PM Taught Me About the PM’s Job
yappli_developers
0
420
ひとりで始めた AI駆動開発、チームに広げて何が変わったのか
kenichiodo
1
210
リアクションエンジニア ― 小さなリアクションから、話しかけやすい組織をつくる ―
ryuguyana
1
100
GitHub、使う?使わない?
happysamurai294
0
140
自律的なチームを作るためにTechPMがやらないこと
ny7760
0
450
cdk deployとcdkd deploy、実際にデプロイして5倍速近くの差を実測した
yama3133
1
160
20261031_IoTLT_vol140_kitazaki_v1.pdf
kitazaki
0
150
re:Invent の去年のスケジュールを公開します!
miu_crescent
PRO
0
150
200人の配信コメント、 全部Jevが仕分けます 〜 マサカリガードを作ってみた 〜
katayamatg
1
500
[re:Invent2026事前勉強会(有志開催)]続きは、ラスベガスの廊下で / continue-in-the-vegas-hallway
sh_fk2
0
480
推論基盤と Scale-Up Interconnect の現状と制約から俯瞰する技術動向
markunet
2
740
Consistency for mere mortals - A gentle guide to consistency
ufried
0
110
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
560
Product Roadmaps are Hard
iamctodd
55
13k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Side Projects
sachag
456
43k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
500
Un-Boring Meetings
codingconduct
0
480
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
500
Technical Leadership for Architectural Decision Making
baasie
3
620
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
650
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
240
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