SlideShare a Scribd company logo
Submit Search
Upload
自作コンパイラのお話
Report
Share
秋
秋 勇紀
Follow
•
1 like
•
939 views
1
of
53
自作コンパイラのお話
•
1 like
•
939 views
Report
Share
Download Now
Download to read offline
Technology
Fukuoka Engineers Day 2018 Autumnで発表させていただいた資料です
Read more
秋
秋 勇紀
Follow
Recommended
Thoughts On Learning A New Programming Language by
Thoughts On Learning A New Programming Language
Patricia Aas
653 views
•
75 slides
Secure Programming Practices in C++ (NDC Security 2018) by
Secure Programming Practices in C++ (NDC Security 2018)
Patricia Aas
2K views
•
67 slides
Php extensions by
Php extensions
Elizabeth Smith
2K views
•
81 slides
Perl Intro 8 File Handles by
Perl Intro 8 File Handles
Shaun Griffith
463 views
•
10 slides
C++ for Java Developers (JavaZone Academy 2018) by
C++ for Java Developers (JavaZone Academy 2018)
Patricia Aas
1.4K views
•
56 slides
PHP 5.3 And PHP 6 A Look Ahead by
PHP 5.3 And PHP 6 A Look Ahead
thinkphp
4.1K views
•
53 slides
More Related Content
What's hot
The Anatomy of an Exploit (NDC TechTown 2019) by
The Anatomy of an Exploit (NDC TechTown 2019)
Patricia Aas
621 views
•
104 slides
Perl basics for pentesters part 2 by
Perl basics for pentesters part 2
n|u - The Open Security Community
1.2K views
•
26 slides
Perl Basics for Pentesters Part 1 by
Perl Basics for Pentesters Part 1
n|u - The Open Security Community
1.5K views
•
20 slides
Python - Getting to the Essence - Points.com - Dave Park by
Python - Getting to the Essence - Points.com - Dave Park
pointstechgeeks
935 views
•
17 slides
Starting Out With PHP by
Starting Out With PHP
Mark Niebergall
355 views
•
84 slides
C++ The Principles of Most Surprise by
C++ The Principles of Most Surprise
Patricia Aas
1.1K views
•
19 slides
What's hot
(19)
The Anatomy of an Exploit (NDC TechTown 2019) by Patricia Aas
The Anatomy of an Exploit (NDC TechTown 2019)
Patricia Aas
•
621 views
Perl basics for pentesters part 2 by n|u - The Open Security Community
Perl basics for pentesters part 2
n|u - The Open Security Community
•
1.2K views
Perl Basics for Pentesters Part 1 by n|u - The Open Security Community
Perl Basics for Pentesters Part 1
n|u - The Open Security Community
•
1.5K views
Python - Getting to the Essence - Points.com - Dave Park by pointstechgeeks
Python - Getting to the Essence - Points.com - Dave Park
pointstechgeeks
•
935 views
Starting Out With PHP by Mark Niebergall
Starting Out With PHP
Mark Niebergall
•
355 views
C++ The Principles of Most Surprise by Patricia Aas
C++ The Principles of Most Surprise
Patricia Aas
•
1.1K views
Software Vulnerabilities in C and C++ (CppCon 2018) by Patricia Aas
Software Vulnerabilities in C and C++ (CppCon 2018)
Patricia Aas
•
1.1K views
201705 metaprogramming in julia by 岳華 杜
201705 metaprogramming in julia
岳華 杜
•
380 views
Trying to learn C# (NDC Oslo 2019) by Patricia Aas
Trying to learn C# (NDC Oslo 2019)
Patricia Aas
•
997 views
Php7 hhvm and co by Pierre Joye
Php7 hhvm and co
Pierre Joye
•
1.6K views
Utility Modules That You Should Know About by joshua.mcadams
Utility Modules That You Should Know About
joshua.mcadams
•
1.6K views
Secure Programming Practices in C++ (NDC Oslo 2018) by Patricia Aas
Secure Programming Practices in C++ (NDC Oslo 2018)
Patricia Aas
•
2.5K views
Tuples, Dicts and Exception Handling by PranavSB
Tuples, Dicts and Exception Handling
PranavSB
•
234 views
Redis Set Go by KLabCyscorpions-TechBlog
Redis Set Go
KLabCyscorpions-TechBlog
•
821 views
The Ring programming language version 1.8 book - Part 96 of 202 by Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 96 of 202
Mahmoud Samir Fayed
•
7 views
Whatsnew in-perl by daoswald
Whatsnew in-perl
daoswald
•
187 views
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018 by Codemotion
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Codemotion
•
81 views
Getting Testy With Perl6 by Workhorse Computing
Getting Testy With Perl6
Workhorse Computing
•
533 views
Voice That Matter 2010 - Core Audio by Kevin Avila
Voice That Matter 2010 - Core Audio
Kevin Avila
•
631 views
Similar to 自作コンパイラのお話
Hamamatsu.swift @浜松IT合同勉強会 by
Hamamatsu.swift @浜松IT合同勉強会
Takuya Ogawa
355 views
•
45 slides
Ruby is an Acceptable Lisp by
Ruby is an Acceptable Lisp
Astrails
2.4K views
•
85 slides
并发模型介绍 by
并发模型介绍
qiang
787 views
•
28 slides
Java プログラマーのための Swift 入門 #中央線Meetup by
Java プログラマーのための Swift 入門 #中央線Meetup
Shinya Mochida
821 views
•
32 slides
What's New in Swift 4 by
What's New in Swift 4
Young Hoo Kim
763 views
•
66 slides
Clojure Intro by
Clojure Intro
thnetos
10.5K views
•
30 slides
Similar to 自作コンパイラのお話
(18)
Hamamatsu.swift @浜松IT合同勉強会 by Takuya Ogawa
Hamamatsu.swift @浜松IT合同勉強会
Takuya Ogawa
•
355 views
Ruby is an Acceptable Lisp by Astrails
Ruby is an Acceptable Lisp
Astrails
•
2.4K views
并发模型介绍 by qiang
并发模型介绍
qiang
•
787 views
Java プログラマーのための Swift 入門 #中央線Meetup by Shinya Mochida
Java プログラマーのための Swift 入門 #中央線Meetup
Shinya Mochida
•
821 views
What's New in Swift 4 by Young Hoo Kim
What's New in Swift 4
Young Hoo Kim
•
763 views
Clojure Intro by thnetos
Clojure Intro
thnetos
•
10.5K views
swift-nio のアーキテクチャーと RxHttpClient by Shinya Mochida
swift-nio のアーキテクチャーと RxHttpClient
Shinya Mochida
•
1.2K views
scala-gopher: async implementation of CSP for scala by Ruslan Shevchenko
scala-gopher: async implementation of CSP for scala
Ruslan Shevchenko
•
1.9K views
Vim Script Programming by Lin Yo-An
Vim Script Programming
Lin Yo-An
•
5.6K views
eXtreme Tuesday Club at Pivotal Labs ft. Speemdnet / San Francisco - SEP 2015 by Speedment, Inc.
eXtreme Tuesday Club at Pivotal Labs ft. Speemdnet / San Francisco - SEP 2015
Speedment, Inc.
•
1.4K views
python beginner talk slide by jonycse
python beginner talk slide
jonycse
•
867 views
Go Web Development by Cheng-Yi Yu
Go Web Development
Cheng-Yi Yu
•
244 views
Orleankka Intro Circa 2015 by Yevhen Bobrov
Orleankka Intro Circa 2015
Yevhen Bobrov
•
51 views
Denis Lebedev, Swift by Yandex
Denis Lebedev, Swift
Yandex
•
38.4K views
CoderDojo: Intermediate Python programming course by Alexander Galkin
CoderDojo: Intermediate Python programming course
Alexander Galkin
•
1.1K views
Lego: A brick system build by scala by lunfu zhong
Lego: A brick system build by scala
lunfu zhong
•
1.2K views
Python于Web 2.0网站的应用 - QCon Beijing 2010 by Qiangning Hong
Python于Web 2.0网站的应用 - QCon Beijing 2010
Qiangning Hong
•
22.2K views
Rack Middleware by LittleBIGRuby
Rack Middleware
LittleBIGRuby
•
2.4K views
More from 秋 勇紀
For Developing URL Routing of SwiftUI App by
For Developing URL Routing of SwiftUI App
秋 勇紀
260 views
•
22 slides
Tutorial for developing SILOptimizer Pass by
Tutorial for developing SILOptimizer Pass
秋 勇紀
771 views
•
61 slides
A Deeper Deep Dive into Swift Literal by
A Deeper Deep Dive into Swift Literal
秋 勇紀
1.5K views
•
115 slides
What Swifty is, from Enum by
What Swifty is, from Enum
秋 勇紀
1.5K views
•
51 slides
Deep Dive into Swift Literal by
Deep Dive into Swift Literal
秋 勇紀
1.3K views
•
15 slides
SILOptimizerのCode Reading入門 by
SILOptimizerのCode Reading入門
秋 勇紀
239 views
•
31 slides
More from 秋 勇紀
(7)
For Developing URL Routing of SwiftUI App by 秋 勇紀
For Developing URL Routing of SwiftUI App
秋 勇紀
•
260 views
Tutorial for developing SILOptimizer Pass by 秋 勇紀
Tutorial for developing SILOptimizer Pass
秋 勇紀
•
771 views
A Deeper Deep Dive into Swift Literal by 秋 勇紀
A Deeper Deep Dive into Swift Literal
秋 勇紀
•
1.5K views
What Swifty is, from Enum by 秋 勇紀
What Swifty is, from Enum
秋 勇紀
•
1.5K views
Deep Dive into Swift Literal by 秋 勇紀
Deep Dive into Swift Literal
秋 勇紀
•
1.3K views
SILOptimizerのCode Reading入門 by 秋 勇紀
SILOptimizerのCode Reading入門
秋 勇紀
•
239 views
ディープラーニングでポプテピピック by 秋 勇紀
ディープラーニングでポプテピピック
秋 勇紀
•
481 views
Recently uploaded
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue
146 views
•
15 slides
The Role of Patterns in the Era of Large Language Models by
The Role of Patterns in the Era of Large Language Models
Yunyao Li
80 views
•
65 slides
Business Analyst Series 2023 - Week 4 Session 7 by
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10
126 views
•
31 slides
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
ShapeBlue
154 views
•
62 slides
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue
138 views
•
18 slides
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue
88 views
•
9 slides
Recently uploaded
(20)
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue
•
146 views
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language Models
Yunyao Li
•
80 views
Business Analyst Series 2023 - Week 4 Session 7 by DianaGray10
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10
•
126 views
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by ShapeBlue
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
ShapeBlue
•
154 views
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue
•
138 views
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by ShapeBlue
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue
•
88 views
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by ShapeBlue
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
ShapeBlue
•
144 views
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue by ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
ShapeBlue
•
94 views
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by ShapeBlue
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
ShapeBlue
•
88 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue
•
222 views
20231123_Camunda Meetup Vienna.pdf by Phactum Softwareentwicklung GmbH
20231123_Camunda Meetup Vienna.pdf
Phactum Softwareentwicklung GmbH
•
50 views
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... by ShapeBlue
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
ShapeBlue
•
120 views
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash
•
153 views
Uni Systems for Power Platform.pptx by Uni Systems S.M.S.A.
Uni Systems for Power Platform.pptx
Uni Systems S.M.S.A.
•
61 views
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
ShapeBlue
•
93 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson
•
156 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue
•
176 views
Network Source of Truth and Infrastructure as Code revisited by Network Automation Forum
Network Source of Truth and Infrastructure as Code revisited
Network Automation Forum
•
52 views
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue
•
166 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue
•
179 views
自作コンパイラのお話
1.
Swift freddi 1
2.
(@freddi_kit) Python Perl Swift
3.
• Swift •
4.
• = •
• • •
5.
Swift • •
7.
• • C
-> ( ) -> • Swift -> (SIL) -> LLVM IR • C -> Python
9.
• •
10.
• • •
11.
•
12.
•
13.
• • •
14.
(ab,aa )
15.
• • let(
) letlet( ) ( ) let[ ]a … → let letlet[ ]a …→ letlet
16.
• • •
18.
: >> let
a = 10; // l ”l” (accept) accept(Braph.QKeyWord, Braph.TokenNode.identifier(Optional("l"))) ["l"] // e ”le” accept(Braph.QKeyWord, Braph.TokenNode.identifier(Optional("le"))) ["l", "e"] // e ”let” accept(Braph.QForIndetifier, Braph.TokenNode.keyword(Braph.TokenNode.KeyWordType.declaration, Optional("let"))) ["l", "e", "t"] // (undefined). // ”let” undefined ["l", "e", "t", " "] // accept(Braph.QForSeparator, Braph.TokenNode.separator) [" "] //
20.
• • •
21.
• (Syntax) •Syntax Error
• • ( )
22.
< expr >
::= <expr> <+- > <term> <expr> < term > ::= <term> <*/ > <factor> <factor> < factor > ::= literal 10 1
23.
int a =
10 + 5 - 10;
24.
int a =
10 + 5 - 10;
25.
int a =
10 + 5 - 10;
26.
int a =
10 + 5 - 10; +
27.
int a =
10 + 5 - 10; + +
28.
int a =
10 + 5 - 10; + + := `=` := `+` or
29.
30.
Swift Tour tuple BNF(
)
31.
• BNF
32.
• BNF) •
33.
< statement >
::= <declaration> <expr> <return> <assign>
34.
< expr >
::= <expr> + <term> <expr> < term > ::= <term> * <factor> <factor> < factor > ::= literal
35.
< initializer >
::= = <expr> < assign > ::= identifier <initializer> < declaration > ::= let identifier <initializer> var identifier <initializer>
36.
37.
•LL •SLR •LR
•LALR
38.
• LL •
• = OK
39.
• ( )
< expr > ::= <expr> + <term> <expr> • →
40.
•LR SLR LALR
• • OK • LR C++
41.
• •
42.
• •
43.
• LR(1) •
1 LALR(1) LL(1)
44.
•BNF • •
-> • -> LR
45.
https://github.com/freddi-kit/Braph
46.
->
47.
https://github.com/freddi-kit/Braph
48.
ω v
49.
• • •
50.
•
52.
• https://books.rakuten.co.jp/rb/12932375/ • LR
parsing https://www.slideshare.net/ichikaz3/lr-parsing • LLVM LLVM IR clang Brainf**k https://itchyny.hatenablog.com/entry/2017/02/27/100000
53.
https://github.com/freddi-kit/Braph