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
770
mv {C,Golang}- Perl1.0
YAPC::Tokyo 2019のLTです
AnaTofuZ
January 26, 2019
Tweet
Share
More Decks by AnaTofuZ
See All by AnaTofuZ
Pythonで爆速でHello, World!する
anatofuz
0
59
思いつきで推しの誕生日記念コンテンツを2日で作る技術
anatofuz
0
79
AWSで雰囲気でつくる! VRChatの写真変換ピタゴラスイッチ
anatofuz
0
240
令和最新版 Perlコーディングガイド
anatofuz
5
6.3k
rakulangで実装する! RubyVM
anatofuz
6
3k
沖縄の大学で育った学生がエンジニアになるまで
anatofuz
2
5.7k
OpenAPI Generator Perl Clientでも型チューニングしたい!!
anatofuz
0
350
perlimportsから探るPPIの世界
anatofuz
0
3.9k
GraphQLスキーマの設計で考えたこと
anatofuz
1
1.6k
Other Decks in Technology
See All in Technology
会社紹介資料 / Sansan Company Profile
sansan33
PRO
6
360k
ITエンジニアを取り巻く環境とキャリアパス / A career path for Japanese IT engineers
takatama
3
1.5k
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
2.6k
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
5
37k
Standard Schema: スキーマライブラリの統一企画とは何か
nozomuikuta
1
440
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
8
65k
初めてのGoogle Cloud by AWS出身者
harukasakihara
1
710
開発も運用もビジネス部門も! クラウドで実現する「つらくない」統制とセキュリティ / Effortless Governance and Security Enabled by the Cloud
kanny
3
1.2k
会社員しながら本を書いてきた知見の共有
sat
PRO
2
640
カンファレンスのつくりかた / The Conference Code: What Makes It All Work
tomzoh
5
590
AIのための オンボーディングドキュメントを整備する - hirotea
hirotea
8
1.9k
マップを速く表示するために
tsuboyan5
0
170
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
133
9.3k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
Mobile First: as difficult as doing things right
swwweet
223
9.6k
Into the Great Unknown - MozCon
thekraken
38
1.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
820
Testing 201, or: Great Expectations
jmmastey
42
7.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
33k
The Invisible Side of Design
smashingmag
299
50k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
228
22k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
Being A Developer After 40
akosma
91
590k
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