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
電卓アプリで再帰降下法を使った話
Search
nakawai
May 27, 2018
390
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
電卓アプリで再帰降下法を使った話
nakawai
May 27, 2018
More Decks by nakawai
See All by nakawai
AI機能プロジェクト炎上の 3つのしくじりと学び
nakawai
0
370
AI駆動プロダクト開発で最速価値検証
nakawai
0
570
エンジニアがエンジニアリングマネージャーになって最初にやったこと
nakawai
1
1.4k
Android+TensorflowでAI画像生成
nakawai
0
84
AndroidでSRCNN(超解像ニューラルネットワーク) 2017
nakawai
0
78
Androidで超解像ニューラルネットワークできる?
nakawai
0
100
Featured
See All Featured
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
400
How to Talk to Developers About Accessibility
jct
2
570
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
RailsConf 2023
tenderlove
30
1.6k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
320
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
450
Unsuck your backbone
ammeep
672
58k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
How GitHub (no longer) Works
holman
316
150k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
Transcript
電卓アプリで 再帰下降構文解析を 使った話 かものはし 2018/5/27 @kawai
どんな電卓?
デモ
1. 式の計算 2. 式の編集 3. 式の参照 要件
行計算できる 電卓
「式」の計算
“3+4” ↓ 3 + 4 ↓ 7
“√4+(3-15)” ↓ √4+(3-15) ↓ 2+-12
“100+8%” ↓ 100+(100×0.08) ↓ 100+8
“100×÷8” ↓ 無効な式
構文解析が必要
式の文字列から結果を導くには 1. トークンに分解 2. 処理用にパース 3. パース結果を処理
↑をトークンに分解 √4+(3-15)
√4+(3-15) 4 √ + - 3 15 ) (
処理用にパース
アルゴリズム
・操車場アルゴリズム(Shunting Yard Algorithm ) 中置 → 後置(逆ポーランド記法) ・再帰降下法 中置 → 構文木 → 評価
- 3 5 - 3 5 - 3 5 操
車 場 再帰降下法
- 3 15 4 √ + - 3 15 )
( √ 4 +
実装など
Evaluater Parser Tokenizer ParserTest EvaluaterTest Unit Test TokenizerTest Core Logic
電卓アプリで 再帰降下法を使った話 以上