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
電卓アプリで再帰降下法を使った話
Search
nakawai
May 27, 2018
350
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
330
AI駆動プロダクト開発で最速価値検証
nakawai
0
520
エンジニアがエンジニアリングマネージャーになって最初にやったこと
nakawai
2
1.4k
Android+TensorflowでAI画像生成
nakawai
0
72
AndroidでSRCNN(超解像ニューラルネットワーク) 2017
nakawai
0
71
Androidで超解像ニューラルネットワークできる?
nakawai
0
91
Featured
See All Featured
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
310
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1.1k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
610
BBQ
matthewcrist
89
10k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Everyday Curiosity
cassininazir
0
230
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
240
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
840
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
A Soul's Torment
seathinner
6
2.9k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
340
Paper Plane
katiecoart
PRO
1
51k
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
電卓アプリで 再帰降下法を使った話 以上