SlideShare a Scribd company logo
A brand new way of
Perl product, and it‟s future
Masaaki Goshima (@goccy54)
mixi Inc.
Me
• Name : Masaaki Goshima (@goccy54)
• Job : mixi (Tanpopo Group)
– Development for Developers
– Developing a platform for refining legacy software
– Managing Jenkins
• Personally, interested in Perl and developing
yet another Perl, gperl
– (YAPC::Asia 2012) Perlと出会いPerlを作る
gperl
• Fastest perl-like language
– Aiming perl5 compatible syntax
– Written with C++
• The last commit for repository was 11 months
ago...
– “Is this already departed !?”
NO! ITS STILL ALIVE!!!
• However, gperl itself has departed
• Modules(lexical analyzer, parser, code
generator, interpreter) are useful
– Lexical analyzer: implementing perl5 syntax
highlighter
– Parser: static analysis tool (used as
refinement of legacy perl5 code)
Input ->Lexer -> Parser ->CodeGenerator -> VM (JIT) -> output
This presentation‟s Goal
• Today, we‟re going to present “Spinout
projects” for each modules
gperl
Compiler::Lexer Compiler::Parser
Compiler::CodeGenerator
::LLVM
Lexer
Parser CodeGenerator
???::???::??? ?????
Next Module
Agenda
• Section 1
– Introduction of Compiler::* Modules
• Section 2
– (Application1) Running on multi platforms
• Section 3
– (Application2) Static analysis tool
Section1
• Introduction of Compiler::* Modules
1. Compiler::Lexer
– Lexical Analyzer for Perl5
2. Compiler::Parser
– Create Abstract Syntax Tree for Perl5
3. Compiler::CodeGenerator::LLVM
– Create LLVM IR for Perl5
Compiler::Lexer
• Lexical Analyzer for Perl5
• Features
– Simple (return Array Reference of Token Object)
– Fast (faster 10 ~ 100 times than PPI::Tokenize)
• Wirtten with C++
• Perfect hashing for reserved keywords
• memory pool for token objects
– Readable Code
• Nothing use parser generator like yacc/bison
Example
1: my$v = sprintf(<<'TEMPLATE', 'yapc');
2: %s::Asia
3: TEMPLATE
4: $v =~ s#yapc#YAPC#;
%s::Asia : HereDocument
TEMPLATE : HereDocumentEnd
$v : Var
=~ : RegOK
s : RegReplace
# : RegDelim
yapc : RegReplaceFrom
# : RegMiddleDelim
YAPC : RegReplaceTo
# : RegDelim
; : SemiColon
my : VarDecl
$v : LocalVar
= : Assign
sprintf : BuiltinFunc
( : LeftParenthesis
<< : LeftShift
TEMPLATE : HereDocumentRawTag
, : Comma
yapc : RawString
) : RightParenthesis
; : SemiColon
tokenize
Tips
• Cannot tokenize pattern
1. func*v
• 「*」is Glob or Mul
2. func/ ..
• 「/」is RegexDelimiter or Div
3. func<<FLAG
• 「FLAG」is HereDocumentTag or Constant
It may make a mistake
Future plan
• Supporting recursively tokenizing
– More wide range of parsing application
– Recursive parsing will take time, optimizing
will be next future work
func*v =>func(*v) or func() * v
func/ … =>func(/../) or func() / v
func<<FLAG =>func(<<FLAG) or func() << FLAG
sub func($) {} or sub func() {}
Compiler::Parser
• Create Abstract Syntax Tree for Perl5
• Features
– Fast (faster than PPI)
– Readable Code
• Simple design
• Nothing use generator
Can generate Virtual Machine code
as walking tree by post order
->
$a->{b}->[0]->c(@args)
->
->
$a {}
b
[]
c
0
@args
left
left
left
right
argsright
right
data
data
Example
my$v= sin$v + $v * $v / $v - $v&&$v
my($v= (sin((($v+ (($v* $v) / $v)) - $v))&&$v))
=
$v &&
left right
rightleft
The most difficult part of
Perl5 parser:
hidden(optional)
parenthesis
Example2) Can parse BlackPerl
BEFOREHAND: close door, each window &exit;
waituntiltime;
open spell book; study;
read (spell, $scan, select); tell us;
write it, print(thehex) whileeach watches,
reverse length,write again;
kill spiders, pop them, chop,
split, kill them. unlink arms, shift,
waitand listen (listening, wait).
sort the flock (then,
warn"the goats", kill"the sheep");
kill them, dump qualms,
shift moralities, values aside, each one;
die sheep; die (to, reversethe => system
you accept (reject, respect));
next step, killnext sacrifice,
each sacrifice, wait, redo ritual
until"all the spirits are pleased";
do it ("as they say").
do it(*everyone***must***participate***in***forbidden**s*e*x*).
return last victim; package body;
exitcrypt
(time, times&“half a time”)
&close it.
select (quickly) and
warnnext victim;
AFTERWARDS: tell nobody.
wait, waituntiltime;
wait until next year, next decade;
sleep, sleep, die yourself,
die@last
BlackPerl for Perl5
Future plan
• Replace PPI !!!
– Supporting some expressions
• ThreeTermOperator, Glob, given/when, goto etc..
– Supporting compatible methods PPI provides
• PPI::Document::find
• PPI::Document::prune
Compiler::CodeGenerator::LLVM
• Create LLVM IR for Perl5
->
$a->{b}->[0]->c(@args)
->
->
$a {}
b
[]
c
0
@args
left
left
left
right
argsright
right
data
data
1 2
3
4 5
6
7 8
9
10
Compiler::Parser Compiler::CodeGenerator::LLVM
LLVM IR
Running
with JIT
Native Code
Other Language
LLVM(Low Level Virtual Machine)
• Compiler Infrastructure
• Better than GNU GCC
LLVM
X86
ARM
Power
C/C++/Object
ive-C
JavaScript
py2llvm
MacRuby
clang
How to use
• Dependency: clang/llvm version 3.2 or 3.3
useCompiler::Lexer;
useCompiler::Parser;
useCompiler::CodeGenerator::LLVM;
my$tokens = Compiler::Lexer->new('')->tokenize($code);
my $ast= Compiler::Parser->new->parse($tokens);
my$generator = Compiler::CodeGenerator::LLVM->new();
my$llvm_ir= $generator->generate($ast); # generate LLVM IR
$generator->debug_run($ast); # run with JIT
Benchmark(Fibonacci)
Language
time(real)[
sec]
X
gperl 0.10 X81.2
LuaJIT
(2.0.0-beta10)
0.12 X67.6
v8(0.8.0) 0.18 X45.1
Compiler::CodeGenerator::
LLVM
0.72 X11.2
Perl(5.16.0) 8.12 X1.0
Environment
MacOSX(10.8.4)
2.2GHz Intel Core i7
Memory: 8GB
N=35
Section 2
• Application1)
– Running on multi platforms
1. Running on Web Browser
• Recently, way of writing code that runs on web
browser is not onlyJavaScript
– e.g.) CoffeScript, JSX, TypeScript, Dart
• I wrote module for Perl5!
SEE ALSO :perl.js (@gfx)
Compiler::Tools::Transpiler
• Translate Perl5 codes to JavaScript codes
– (Step1) translate Perl5 codes to LLVM-IR with
Compiler::* modules
– (Step2) translate LLVM-IR to JavaScript codes with
emscripten
Perl5
LLVM emscripten
How to use
useCompiler::Tools::Transpiler;
my$transpiler= Compiler::Tools::Transpiler->new({
engine=>'JavaScript‟,
library_path=> [„lib‟]
});
openmy $fh, '<', 'target_application.pl';
my$perl5_code = do { local$/; <$fh> };
my$javascript_code= $transpiler->transpile($perl5_code);
open $fh, '>', 'target_application.js';
print$fh $javascript_code;
close$fh;
※ Needs clang-3.2 and LLVM-3.2 (Not ver. 3.3 or later) because emscripten has still not
support LLVM 3.3 or later
ROADMAP/Repository
• Fix some emscripten‟s bugs
• Supporting accessors for HTML objects
• Supporting Canvas API
• etc..
• Repository
– https://github.com/goccy/p5-Compiler-Tools-Transpiler.git
2. Running on iOS and OSX
• Recently, software that can develop iOS or OSX
applications using light weight language has
being released
– RubyMotion
– mocl
– Titanium
• I wrote module for Perl5!
PerlMotion
iOS and OS X development
using the Perl5 programming language
PerlMotion’s Architecture
UIKit
Cocoa Touch Frameworks
Core Animation Core Audio Core Data
Perl5 x Cocoa Touch Frameworks
Bindings Library
LLVM IR
(Links Perl5 codes and Cocoa Touch Frameworks)
Perl5 Codes
Compiler::Lexer
Compiler::Parser
Compiler::CodeGenerator::LLVM
iOS Simulator iOS DeviceMacOSX
Generates Native Code for each target Architecture
DEMO
• HelloWorldby PerlMotion
Current Status
Still not support functions
Symbol Management System : Glob
Garbage Collection
Regexp
Three Term Operator
etc..
Not support functions
Dynamic evaluation like eval, s/../../e,
require
Supported functions
Primitive Types : Int, double, String, Array,
Hash, ArrayRefence, HashReference,
IOHandler, BlessedObject …
Operators : binary operator, single term
operator …
BuiltinFunction : print, say, shift, push, sin,
open …
Variable Definition, Function Definition
OOP System : package, bless, @ISA
ROADMAP
• Supporting deployment on device
• Preparing debugging environment
– (stdout/stderr/gdb..etc)
• Supporting existing framework (e.g. UIKit)
• Supporting CPAN modules written by Pure Perl
2014/4
Will release at April, 2014!
Welcome your Contribution!
• I want discuss design or objective
– Especially, I need advice on “What Perl
community likes?” (Naming rule, etc…)
https://github.com/goccy/perl-motion.git
Conclusion at Section 1 and 2
• Perl5 codes Run Anywhere!!!
– iOS,OSX,Web Browser and others
• Welcome your Contribution
– Compiler::Lexer
• https://github.com/goccy/p5-Compiler-Lexer.git
– Compiler::Parser
• https://github.com/goccy/p5-Compiler-Parser.git
– Compiler::CodeGenerator::LLVM
• https://github.com/goccy/p5-Compiler-CodeGenerator.git
– Compiler::Tools::Transpiler
• https://github.com/goccy/p5-Compiler-Tools-Transpiler.git
– PerlMotion
• https://github.com/goccy/perl-motion.git
• Application2)
– Static analysis tool
Section3
Compiler::Tools::CopyPasteDetector
• Detect Copy and Paste for Perl5
• Features
– Fast (detecting Engine written by C++ with
POSIX Thread)
– Accuracy (based on Compiler::Lexer and
B::Deparse)
– High functionality Visualizer
(some metrics or scattergram etc…)
DEMO
• Detect Copy & Paste of Catalyst and Mojolicious
Another Modules
• Perl::MinimumVersion::Fast(@tokuhirom)
– Find a minimum required version of perl for Perl code
• Test::LocalFunctions::Fast(@papix)
– Detect unused local function
Compiler::Lexer or Compiler::Parser provide that
you can write faster modules than existing module that uses PPI
Future plan
• Perl::Metrics::Simple::Fast
– Will release faster module than
Perl::Metrics::Simple by using
Compiler::Lexer and Compiler::Parser
• Next future, I will CPANize of static alnalysis
module that has been used at mixi
– It includes rich Visualizer
Conclusion at Section 3
• Introduction of copy and paste detecting
tool for Perl5
– Compiler::Tools::CopyPasteDetector
• Compiler::Lexer or Compiler::Parser provide that
you can write faster modules than existing
module that uses PPI
Finally
Compiler::Lexer Compiler::Parser
Compiler::CodeGenerator
::LLVM
Type Inference
Engine
Static Typing
- Coming soon -
gperl will assemble these brand new modules...
これからのPerlプロダクトのかたち(YAPC::Asia 2013)

More Related Content

What's hot

2008 07-24 kwpm-threads_and_synchronization
2008 07-24 kwpm-threads_and_synchronization2008 07-24 kwpm-threads_and_synchronization
2008 07-24 kwpm-threads_and_synchronizationfangjiafu
 
Memory Management In Python The Basics
Memory Management In Python The BasicsMemory Management In Python The Basics
Memory Management In Python The Basics
Nina Zakharenko
 
JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011Charles Nutter
 
Down the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM WonderlandDown the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM Wonderland
Charles Nutter
 
Experiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRubyExperiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRuby
Matthew Gaudet
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
Sylvain Wallez
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
Abbas Raza
 
Seeking Clojure
Seeking ClojureSeeking Clojure
Seeking Clojure
chrisriceuk
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
Mattias Karlsson
 
Asynchronous I/O in Python 3
Asynchronous I/O in Python 3Asynchronous I/O in Python 3
Asynchronous I/O in Python 3
Feihong Hsu
 
Know yourengines velocity2011
Know yourengines velocity2011Know yourengines velocity2011
Know yourengines velocity2011
Demis Bellot
 
あなたのScalaを爆速にする7つの方法
あなたのScalaを爆速にする7つの方法あなたのScalaを爆速にする7つの方法
あなたのScalaを爆速にする7つの方法
x1 ichi
 
Why GC is eating all my CPU?
Why GC is eating all my CPU?Why GC is eating all my CPU?
Why GC is eating all my CPU?
Roman Elizarov
 
Spl to the Rescue - Zendcon 09
Spl to the Rescue - Zendcon 09Spl to the Rescue - Zendcon 09
Spl to the Rescue - Zendcon 09
Elizabeth Smith
 
Doctrine 2.0 Enterprise Persistence Layer for PHP
Doctrine 2.0 Enterprise Persistence Layer for PHPDoctrine 2.0 Enterprise Persistence Layer for PHP
Doctrine 2.0 Enterprise Persistence Layer for PHP
Guilherme Blanco
 
Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"
SATOSHI TAGOMORI
 
Hacking with hhvm
Hacking with hhvmHacking with hhvm
Hacking with hhvm
Elizabeth Smith
 
Down the Rabbit Hole
Down the Rabbit HoleDown the Rabbit Hole
Down the Rabbit Hole
Charles Nutter
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
Doug Hawkins
 

What's hot (20)

2008 07-24 kwpm-threads_and_synchronization
2008 07-24 kwpm-threads_and_synchronization2008 07-24 kwpm-threads_and_synchronization
2008 07-24 kwpm-threads_and_synchronization
 
Memory Management In Python The Basics
Memory Management In Python The BasicsMemory Management In Python The Basics
Memory Management In Python The Basics
 
JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011
 
Down the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM WonderlandDown the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM Wonderland
 
Experiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRubyExperiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRuby
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
Seeking Clojure
Seeking ClojureSeeking Clojure
Seeking Clojure
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
Asynchronous I/O in Python 3
Asynchronous I/O in Python 3Asynchronous I/O in Python 3
Asynchronous I/O in Python 3
 
Know yourengines velocity2011
Know yourengines velocity2011Know yourengines velocity2011
Know yourengines velocity2011
 
あなたのScalaを爆速にする7つの方法
あなたのScalaを爆速にする7つの方法あなたのScalaを爆速にする7つの方法
あなたのScalaを爆速にする7つの方法
 
Why GC is eating all my CPU?
Why GC is eating all my CPU?Why GC is eating all my CPU?
Why GC is eating all my CPU?
 
Spl to the Rescue - Zendcon 09
Spl to the Rescue - Zendcon 09Spl to the Rescue - Zendcon 09
Spl to the Rescue - Zendcon 09
 
DSLs in JavaScript
DSLs in JavaScriptDSLs in JavaScript
DSLs in JavaScript
 
Doctrine 2.0 Enterprise Persistence Layer for PHP
Doctrine 2.0 Enterprise Persistence Layer for PHPDoctrine 2.0 Enterprise Persistence Layer for PHP
Doctrine 2.0 Enterprise Persistence Layer for PHP
 
Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"
 
Hacking with hhvm
Hacking with hhvmHacking with hhvm
Hacking with hhvm
 
Down the Rabbit Hole
Down the Rabbit HoleDown the Rabbit Hole
Down the Rabbit Hole
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 

Viewers also liked

"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pmRyosuke IWANAGA
 
YAPCレポートの舞台裏
YAPCレポートの舞台裏YAPCレポートの舞台裏
YAPCレポートの舞台裏
Masahiro Honma
 
テーマ「最適化」
テーマ「最適化」テーマ「最適化」
テーマ「最適化」
technocat
 
PHPカンファレンス北海道_20160416
PHPカンファレンス北海道_20160416PHPカンファレンス北海道_20160416
PHPカンファレンス北海道_20160416
Yoshihiro Sasaki
 
Currying in perl
Currying in perlCurrying in perl
Currying in perl
Masahiro Honma
 
Games::* - Perlで 「ゲーム」しよう #hokkaidopm
Games::* - Perlで 「ゲーム」しよう #hokkaidopmGames::* - Perlで 「ゲーム」しよう #hokkaidopm
Games::* - Perlで 「ゲーム」しよう #hokkaidopm
鉄次 尾形
 
Google trends to_irc
Google trends to_ircGoogle trends to_irc
Google trends to_ircrarere
 
YAPC::Asia 2013 - CPAN Testers Reports の情報を上手に使う
YAPC::Asia 2013 - CPAN Testers Reports の情報を上手に使うYAPC::Asia 2013 - CPAN Testers Reports の情報を上手に使う
YAPC::Asia 2013 - CPAN Testers Reports の情報を上手に使う
moznion
 
Asset Pipeline for Perl
Asset Pipeline for PerlAsset Pipeline for Perl
Asset Pipeline for Perl
Yoshihiro Sasaki
 
理解したつもりになるGit入門
理解したつもりになるGit入門理解したつもりになるGit入門
理解したつもりになるGit入門Yoshihiro Sasaki
 
Plack::Request with Encoding
Plack::Request with EncodingPlack::Request with Encoding
Plack::Request with Encoding
moznion
 
テーマ「なんでもないようなこと」
テーマ「なんでもないようなこと」テーマ「なんでもないようなこと」
テーマ「なんでもないようなこと」
technocat
 
Takao.mt 2013
Takao.mt 2013Takao.mt 2013
Takao.mt 2013
moznion
 
CPAN/便利モジュール
CPAN/便利モジュールCPAN/便利モジュール
CPAN/便利モジュール
Yoshihiro Sasaki
 
Perl 非同期プログラミング
Perl 非同期プログラミングPerl 非同期プログラミング
Perl 非同期プログラミングlestrrat
 
変数、リファレンス
変数、リファレンス変数、リファレンス
変数、リファレンス
charsbar
 

Viewers also liked (20)

Use Carton
Use CartonUse Carton
Use Carton
 
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
 
YAPCレポートの舞台裏
YAPCレポートの舞台裏YAPCレポートの舞台裏
YAPCレポートの舞台裏
 
テーマ「最適化」
テーマ「最適化」テーマ「最適化」
テーマ「最適化」
 
PHPカンファレンス北海道_20160416
PHPカンファレンス北海道_20160416PHPカンファレンス北海道_20160416
PHPカンファレンス北海道_20160416
 
YAPC::AsiaとHokkaido.pm
YAPC::AsiaとHokkaido.pmYAPC::AsiaとHokkaido.pm
YAPC::AsiaとHokkaido.pm
 
Currying in perl
Currying in perlCurrying in perl
Currying in perl
 
Games::* - Perlで 「ゲーム」しよう #hokkaidopm
Games::* - Perlで 「ゲーム」しよう #hokkaidopmGames::* - Perlで 「ゲーム」しよう #hokkaidopm
Games::* - Perlで 「ゲーム」しよう #hokkaidopm
 
Google trends to_irc
Google trends to_ircGoogle trends to_irc
Google trends to_irc
 
YAPC::Asia 2013 - CPAN Testers Reports の情報を上手に使う
YAPC::Asia 2013 - CPAN Testers Reports の情報を上手に使うYAPC::Asia 2013 - CPAN Testers Reports の情報を上手に使う
YAPC::Asia 2013 - CPAN Testers Reports の情報を上手に使う
 
Asset Pipeline for Perl
Asset Pipeline for PerlAsset Pipeline for Perl
Asset Pipeline for Perl
 
理解したつもりになるGit入門
理解したつもりになるGit入門理解したつもりになるGit入門
理解したつもりになるGit入門
 
Using Dancer
Using DancerUsing Dancer
Using Dancer
 
Plack::Request with Encoding
Plack::Request with EncodingPlack::Request with Encoding
Plack::Request with Encoding
 
テーマ「なんでもないようなこと」
テーマ「なんでもないようなこと」テーマ「なんでもないようなこと」
テーマ「なんでもないようなこと」
 
Takao.mt 2013
Takao.mt 2013Takao.mt 2013
Takao.mt 2013
 
CPAN/便利モジュール
CPAN/便利モジュールCPAN/便利モジュール
CPAN/便利モジュール
 
Perl 非同期プログラミング
Perl 非同期プログラミングPerl 非同期プログラミング
Perl 非同期プログラミング
 
変数、リファレンス
変数、リファレンス変数、リファレンス
変数、リファレンス
 
cpanfile
cpanfilecpanfile
cpanfile
 

Similar to これからのPerlプロダクトのかたち(YAPC::Asia 2013)

Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)
p3castro
 
50 shades of PHP
50 shades of PHP50 shades of PHP
50 shades of PHP
Maksym Hopei
 
Golang
GolangGolang
Golang
GolangGolang
A brief to PHP 7.3
A brief to PHP 7.3A brief to PHP 7.3
A brief to PHP 7.3
Xinchen Hui
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
Antony Abramchenko
 
Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)
Martijn Verburg
 
Eugene PHP June 2015 - Let's Talk Laravel
Eugene PHP June 2015 - Let's Talk LaravelEugene PHP June 2015 - Let's Talk Laravel
Eugene PHP June 2015 - Let's Talk Laravel
anaxamaxan
 
Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)
Viral Solani
 
Where is the bottleneck
Where is the bottleneckWhere is the bottleneck
Where is the bottleneck
Manuel Miranda de Cid
 
Getting Started with Go
Getting Started with GoGetting Started with Go
Getting Started with Go
Steven Francia
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
Troy Miles
 
Search Lucene
Search LuceneSearch Lucene
Search Lucene
Jeremy Coates
 
Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"
Fwdays
 
Metasploit For Beginners
Metasploit For BeginnersMetasploit For Beginners
Metasploit For Beginners
Ramnath Shenoy
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
Diego Freniche Brito
 

Similar to これからのPerlプロダクトのかたち(YAPC::Asia 2013) (20)

Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)
 
50 shades of PHP
50 shades of PHP50 shades of PHP
50 shades of PHP
 
Golang
GolangGolang
Golang
 
Golang
GolangGolang
Golang
 
A brief to PHP 7.3
A brief to PHP 7.3A brief to PHP 7.3
A brief to PHP 7.3
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
 
Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)
 
Eugene PHP June 2015 - Let's Talk Laravel
Eugene PHP June 2015 - Let's Talk LaravelEugene PHP June 2015 - Let's Talk Laravel
Eugene PHP June 2015 - Let's Talk Laravel
 
Modern PHP
Modern PHPModern PHP
Modern PHP
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)Introduction to Laravel Framework (5.2)
Introduction to Laravel Framework (5.2)
 
Where is the bottleneck
Where is the bottleneckWhere is the bottleneck
Where is the bottleneck
 
Getting Started with Go
Getting Started with GoGetting Started with Go
Getting Started with Go
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
 
Search Lucene
Search LuceneSearch Lucene
Search Lucene
 
Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"Игорь Фесенко "Direction of C# as a High-Performance Language"
Игорь Фесенко "Direction of C# as a High-Performance Language"
 
Metasploit For Beginners
Metasploit For BeginnersMetasploit For Beginners
Metasploit For Beginners
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 

Recently uploaded

Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 

Recently uploaded (20)

Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 

これからのPerlプロダクトのかたち(YAPC::Asia 2013)

  • 1. A brand new way of Perl product, and it‟s future Masaaki Goshima (@goccy54) mixi Inc.
  • 2. Me • Name : Masaaki Goshima (@goccy54) • Job : mixi (Tanpopo Group) – Development for Developers – Developing a platform for refining legacy software – Managing Jenkins • Personally, interested in Perl and developing yet another Perl, gperl – (YAPC::Asia 2012) Perlと出会いPerlを作る
  • 3. gperl • Fastest perl-like language – Aiming perl5 compatible syntax – Written with C++ • The last commit for repository was 11 months ago... – “Is this already departed !?”
  • 4. NO! ITS STILL ALIVE!!! • However, gperl itself has departed • Modules(lexical analyzer, parser, code generator, interpreter) are useful – Lexical analyzer: implementing perl5 syntax highlighter – Parser: static analysis tool (used as refinement of legacy perl5 code) Input ->Lexer -> Parser ->CodeGenerator -> VM (JIT) -> output
  • 5. This presentation‟s Goal • Today, we‟re going to present “Spinout projects” for each modules gperl Compiler::Lexer Compiler::Parser Compiler::CodeGenerator ::LLVM Lexer Parser CodeGenerator ???::???::??? ????? Next Module
  • 6. Agenda • Section 1 – Introduction of Compiler::* Modules • Section 2 – (Application1) Running on multi platforms • Section 3 – (Application2) Static analysis tool
  • 7. Section1 • Introduction of Compiler::* Modules 1. Compiler::Lexer – Lexical Analyzer for Perl5 2. Compiler::Parser – Create Abstract Syntax Tree for Perl5 3. Compiler::CodeGenerator::LLVM – Create LLVM IR for Perl5
  • 8. Compiler::Lexer • Lexical Analyzer for Perl5 • Features – Simple (return Array Reference of Token Object) – Fast (faster 10 ~ 100 times than PPI::Tokenize) • Wirtten with C++ • Perfect hashing for reserved keywords • memory pool for token objects – Readable Code • Nothing use parser generator like yacc/bison
  • 9. Example 1: my$v = sprintf(<<'TEMPLATE', 'yapc'); 2: %s::Asia 3: TEMPLATE 4: $v =~ s#yapc#YAPC#; %s::Asia : HereDocument TEMPLATE : HereDocumentEnd $v : Var =~ : RegOK s : RegReplace # : RegDelim yapc : RegReplaceFrom # : RegMiddleDelim YAPC : RegReplaceTo # : RegDelim ; : SemiColon my : VarDecl $v : LocalVar = : Assign sprintf : BuiltinFunc ( : LeftParenthesis << : LeftShift TEMPLATE : HereDocumentRawTag , : Comma yapc : RawString ) : RightParenthesis ; : SemiColon tokenize
  • 10. Tips • Cannot tokenize pattern 1. func*v • 「*」is Glob or Mul 2. func/ .. • 「/」is RegexDelimiter or Div 3. func<<FLAG • 「FLAG」is HereDocumentTag or Constant It may make a mistake
  • 11. Future plan • Supporting recursively tokenizing – More wide range of parsing application – Recursive parsing will take time, optimizing will be next future work func*v =>func(*v) or func() * v func/ … =>func(/../) or func() / v func<<FLAG =>func(<<FLAG) or func() << FLAG sub func($) {} or sub func() {}
  • 12. Compiler::Parser • Create Abstract Syntax Tree for Perl5 • Features – Fast (faster than PPI) – Readable Code • Simple design • Nothing use generator Can generate Virtual Machine code as walking tree by post order -> $a->{b}->[0]->c(@args) -> -> $a {} b [] c 0 @args left left left right argsright right data data
  • 13. Example my$v= sin$v + $v * $v / $v - $v&&$v my($v= (sin((($v+ (($v* $v) / $v)) - $v))&&$v)) = $v && left right rightleft The most difficult part of Perl5 parser: hidden(optional) parenthesis
  • 14. Example2) Can parse BlackPerl BEFOREHAND: close door, each window &exit; waituntiltime; open spell book; study; read (spell, $scan, select); tell us; write it, print(thehex) whileeach watches, reverse length,write again; kill spiders, pop them, chop, split, kill them. unlink arms, shift, waitand listen (listening, wait). sort the flock (then, warn"the goats", kill"the sheep"); kill them, dump qualms, shift moralities, values aside, each one; die sheep; die (to, reversethe => system you accept (reject, respect)); next step, killnext sacrifice, each sacrifice, wait, redo ritual until"all the spirits are pleased"; do it ("as they say"). do it(*everyone***must***participate***in***forbidden**s*e*x*). return last victim; package body; exitcrypt (time, times&“half a time”) &close it. select (quickly) and warnnext victim; AFTERWARDS: tell nobody. wait, waituntiltime; wait until next year, next decade; sleep, sleep, die yourself, die@last BlackPerl for Perl5
  • 15. Future plan • Replace PPI !!! – Supporting some expressions • ThreeTermOperator, Glob, given/when, goto etc.. – Supporting compatible methods PPI provides • PPI::Document::find • PPI::Document::prune
  • 16. Compiler::CodeGenerator::LLVM • Create LLVM IR for Perl5 -> $a->{b}->[0]->c(@args) -> -> $a {} b [] c 0 @args left left left right argsright right data data 1 2 3 4 5 6 7 8 9 10 Compiler::Parser Compiler::CodeGenerator::LLVM LLVM IR Running with JIT
  • 17. Native Code Other Language LLVM(Low Level Virtual Machine) • Compiler Infrastructure • Better than GNU GCC LLVM X86 ARM Power C/C++/Object ive-C JavaScript py2llvm MacRuby clang
  • 18. How to use • Dependency: clang/llvm version 3.2 or 3.3 useCompiler::Lexer; useCompiler::Parser; useCompiler::CodeGenerator::LLVM; my$tokens = Compiler::Lexer->new('')->tokenize($code); my $ast= Compiler::Parser->new->parse($tokens); my$generator = Compiler::CodeGenerator::LLVM->new(); my$llvm_ir= $generator->generate($ast); # generate LLVM IR $generator->debug_run($ast); # run with JIT
  • 19. Benchmark(Fibonacci) Language time(real)[ sec] X gperl 0.10 X81.2 LuaJIT (2.0.0-beta10) 0.12 X67.6 v8(0.8.0) 0.18 X45.1 Compiler::CodeGenerator:: LLVM 0.72 X11.2 Perl(5.16.0) 8.12 X1.0 Environment MacOSX(10.8.4) 2.2GHz Intel Core i7 Memory: 8GB N=35
  • 20. Section 2 • Application1) – Running on multi platforms
  • 21. 1. Running on Web Browser • Recently, way of writing code that runs on web browser is not onlyJavaScript – e.g.) CoffeScript, JSX, TypeScript, Dart • I wrote module for Perl5! SEE ALSO :perl.js (@gfx)
  • 22. Compiler::Tools::Transpiler • Translate Perl5 codes to JavaScript codes – (Step1) translate Perl5 codes to LLVM-IR with Compiler::* modules – (Step2) translate LLVM-IR to JavaScript codes with emscripten Perl5 LLVM emscripten
  • 23. How to use useCompiler::Tools::Transpiler; my$transpiler= Compiler::Tools::Transpiler->new({ engine=>'JavaScript‟, library_path=> [„lib‟] }); openmy $fh, '<', 'target_application.pl'; my$perl5_code = do { local$/; <$fh> }; my$javascript_code= $transpiler->transpile($perl5_code); open $fh, '>', 'target_application.js'; print$fh $javascript_code; close$fh; ※ Needs clang-3.2 and LLVM-3.2 (Not ver. 3.3 or later) because emscripten has still not support LLVM 3.3 or later
  • 24. ROADMAP/Repository • Fix some emscripten‟s bugs • Supporting accessors for HTML objects • Supporting Canvas API • etc.. • Repository – https://github.com/goccy/p5-Compiler-Tools-Transpiler.git
  • 25. 2. Running on iOS and OSX • Recently, software that can develop iOS or OSX applications using light weight language has being released – RubyMotion – mocl – Titanium • I wrote module for Perl5!
  • 26. PerlMotion iOS and OS X development using the Perl5 programming language
  • 27. PerlMotion’s Architecture UIKit Cocoa Touch Frameworks Core Animation Core Audio Core Data Perl5 x Cocoa Touch Frameworks Bindings Library LLVM IR (Links Perl5 codes and Cocoa Touch Frameworks) Perl5 Codes Compiler::Lexer Compiler::Parser Compiler::CodeGenerator::LLVM iOS Simulator iOS DeviceMacOSX Generates Native Code for each target Architecture
  • 29. Current Status Still not support functions Symbol Management System : Glob Garbage Collection Regexp Three Term Operator etc.. Not support functions Dynamic evaluation like eval, s/../../e, require Supported functions Primitive Types : Int, double, String, Array, Hash, ArrayRefence, HashReference, IOHandler, BlessedObject … Operators : binary operator, single term operator … BuiltinFunction : print, say, shift, push, sin, open … Variable Definition, Function Definition OOP System : package, bless, @ISA
  • 30. ROADMAP • Supporting deployment on device • Preparing debugging environment – (stdout/stderr/gdb..etc) • Supporting existing framework (e.g. UIKit) • Supporting CPAN modules written by Pure Perl 2014/4 Will release at April, 2014!
  • 31. Welcome your Contribution! • I want discuss design or objective – Especially, I need advice on “What Perl community likes?” (Naming rule, etc…) https://github.com/goccy/perl-motion.git
  • 32. Conclusion at Section 1 and 2 • Perl5 codes Run Anywhere!!! – iOS,OSX,Web Browser and others • Welcome your Contribution – Compiler::Lexer • https://github.com/goccy/p5-Compiler-Lexer.git – Compiler::Parser • https://github.com/goccy/p5-Compiler-Parser.git – Compiler::CodeGenerator::LLVM • https://github.com/goccy/p5-Compiler-CodeGenerator.git – Compiler::Tools::Transpiler • https://github.com/goccy/p5-Compiler-Tools-Transpiler.git – PerlMotion • https://github.com/goccy/perl-motion.git
  • 33. • Application2) – Static analysis tool Section3
  • 34. Compiler::Tools::CopyPasteDetector • Detect Copy and Paste for Perl5 • Features – Fast (detecting Engine written by C++ with POSIX Thread) – Accuracy (based on Compiler::Lexer and B::Deparse) – High functionality Visualizer (some metrics or scattergram etc…)
  • 35. DEMO • Detect Copy & Paste of Catalyst and Mojolicious
  • 36. Another Modules • Perl::MinimumVersion::Fast(@tokuhirom) – Find a minimum required version of perl for Perl code • Test::LocalFunctions::Fast(@papix) – Detect unused local function Compiler::Lexer or Compiler::Parser provide that you can write faster modules than existing module that uses PPI
  • 37. Future plan • Perl::Metrics::Simple::Fast – Will release faster module than Perl::Metrics::Simple by using Compiler::Lexer and Compiler::Parser • Next future, I will CPANize of static alnalysis module that has been used at mixi – It includes rich Visualizer
  • 38. Conclusion at Section 3 • Introduction of copy and paste detecting tool for Perl5 – Compiler::Tools::CopyPasteDetector • Compiler::Lexer or Compiler::Parser provide that you can write faster modules than existing module that uses PPI
  • 39. Finally Compiler::Lexer Compiler::Parser Compiler::CodeGenerator ::LLVM Type Inference Engine Static Typing - Coming soon - gperl will assemble these brand new modules...