SlideShare a Scribd company logo
B DSLB DSL
G VMG VM
M MM M
D S LD S L
https://pxhere.com/en/photo/1057524
SELECT country,
COUNT(1) AS count
FROM Customer
GROUP BY country;
Given my account has a balance of € 430
When I receive a money transfer of € 500
Then my account should have a balance of € 930
Setup(
Boat on StartingShore,
Wolf on StartingShore,
Sheep on StartingShore,
Cabbage on StartingShore
) execute (
Boat move Cabbage to StartingShore,
Boat move Sheep to DestinationShore,
Boat move None to StartingShore,
Boat move Cabbage to DestinationShore,
Boat move Sheep to StartingShore,
Boat move Wolf to DestinationShore,
Boat move None to StartingShore,
Boat move Sheep to DestinationShore
)
https://github.com/NRBPerdijk/dsl-for-the-dense/
+ + > + + + + + [ < + > - ] + + + + + + + + [ < + + + + + + > - ] < .
BB
This program adds the numbers 2 and 5
+ + Store the number 2 in the first slot
> + + + + + Store the number 5 in the second slot
[ Move back and forth between first and second slot
< + > - While "moving" ones from the second to the first slot
]
The first slot now has '7' in it but we need to output the ASCII value for that
The ASCII value is 48 higher than the number we have
The second slot is now empty
It will act as a counter so we can add 6 * 8 to the first slot
+ + + + + + + + Store 8 in it
[ Again move back and forth between first and second slot
< + + + + + + while adding 6 to the first slot
> - before reducing the counter in the second slot
]
< . Go back to the first slot and print it
0 1 2 3 4 ... 29 997 29 998 29 999
2 5 3 0 0 0 0 0
↑
command meaning
+ increase value
- decrease value
. print value to std out
, read one byte from std in
[ if value eq 0, jump after matching ]
] if value neq 0, jump after matching [
< move pointer left
> move pointer right
https://www.thepinkhumanist.com/articles/330-life-of-alan-turing-examined-in-a-new-graphic-novel
https://commons.wikimedia.org/wiki/File:USA_tar_bubble_la_brea_CA.jpg
G VMG VM
“One VM to rule them all
cc-by-sa/2.0 - © Lairich Rig - https://www.geograph.org.uk/photo/3203827
BB
yapi.bf calculating 15 digits of π
Runtime Average time (s/op) Error
Java HotSpot(TM) 64-Bit Server VM 0.053 ± 0.001
OpenJDK GraalVM CE 19.0.0 0.045 ± 0.001
All tests are ran on an 2018 MacBook Pro with 2.6 GHz Intel Core i7 and 16 GB 2400 MHz DDR4. The machine runs macOS Mojave 10.14.4 and JDK 1.8.0_212. Tests
measured with . Each test ran 5 times with 5 warmup iterations.jmh
BB
yapi.bf calculating 45 digits of π
Runtime Average time (s/op) Error
Java HotSpot(TM) 64-Bit Server VM 0.207 ± 0.002
OpenJDK GraalVM CE 19.0.0 0.185 ± 0.003
All tests are ran on an 2018 MacBook Pro with 2.6 GHz Intel Core i7 and 16 GB 2400 MHz DDR4. The machine runs macOS Mojave 10.14.4 and JDK 1.8.0_212. Tests
measured with . Each test ran 5 times with 5 warmup iterations.jmh
TT
cc-by-sa/2.5 - © Darvin DeShazer - https://mushroomobserver.org/2538
“open source library for building
programming language implementations
as interpreters for self-modifying Abstract
Syntax Trees.
A S TA S T
ROOT
INCR_VAL INCR_VAL INCR_VAL INCR_VAL INCR_VAL JUMP INCR_VAL INCR_VAL
DECR_PTR INCR_VAL INCR_PTR DECR_VAL
(part of the program that adds 5 and 2)
https://chrisseaton.com/rubytruffle/pldi17-truffle/pldi17-truffle.pdf
P EP E
Calculate for positive integers
If we know that , the program becomes simpler:
x
n
f (x, n) =
⎧
⎩
⎨
⎪
⎪
1
,(f (x, 0.5 ∗ n))
2
x ∗ f (x, n − 1),
if n = 0
if n is even
otherwise
n = 5
f (x) = x ∗ ( )x
2
2
BB
https://pxhere.com/en/photo/493605
BB
@Override
public void execute(final VirtualFrame frame) {
final int currentValue = someCalculation();
doPrint(getContext().getOutput(), (char) currentValue);
}
@TruffleBoundary
private void doPrint(final PrintWriter out, final char value) {
out.print(value);
out.flush();
}
SS
https://www.mammoet.com/cases/Tennet/
SS
@Specialization(guards = "b 0")
public double divide(int a, int b) {
return a / b;
}
SS
@Specialization(rewriteOn = ArithmeticException.class)
int doAddNoOverflow(int a, int b) {
return Math.addExact(a, b);
}
@Specialization
long doAddWithOverflow(int a, int b) {
return a + b;
}
execute(Integer.MAX_VALUE - 1, 1) doAddNoOverflow(Integer.MAX_VALUE - 1, 1)
execute(Integer.MAX_VALUE , 1) doAddNoOverflow(Integer.MAX_VALUE, 1)
throws ArithmeticException
doAddWithOverflow(Integer.MAX_VALUE, 1)
execute(Integer.MAX_VALUE - 1, 1) doAddWithOverflow(Integer.MAX_VALUE - 1, 1)
W G VM JVMW G VM JVM
function abs (int i)
if ( we saw only positive integers in the input ) {
return i;
} else {
transferToInterpreterAndInvalidate;
return i < 0 ? i : i;
}
}
B TB T
LL
Converts a sequence of characters into a sequence of tokens.
PP
Converts a sequence of tokens into (hierarchical) data structure.
P LP L
1. Write some regular expressions
2. Use a parser generator (like )ANTLR
cc-by-nc/2.5 - © Randall Munroe - https://www.xkcd.com/1171/
II
G VM UG VM U
GraalVM comes with the GraalVM Updater (gu)
Use gu to install components, such as language packs or tools.
e.g. gu install native-image
gu -L install brainfuck component-0.1-SNAPSHOT.jar
CC
Distribute your language implementation as a component:
$ tree
.
├── META-INF
│ ├── MANIFEST.MF
│ ├── permissions
│ └── symlinks
└── jre
└── languages
└── bf
├── bin
│ └── bf
├── brainfuck.jar
└── launcher
└── bf launcher.jar
6 directories, 6 files
UU
1. Prepare source code
2. Prepare GraalVM polyglot context
3. Evaluate the source code
input = "+ + > + + + + + [ < + > - ] + + + + + + + + [ < + + + + + + > - ] < .";
source = Source.newBuilder("bf", input, "user input").build();
output = new ByteArrayOutputStream();
context = Context.newBuilder("bf").out(output).build();
context.eval(source);
System.out.println(output.toString());
TT
“Implementing your own language using
GraalVM will not only give you high
performance. More importantly, it allows
your language to connect with the rich
tooling provided by the GraalVM ecosystem.
https://www.graalvm.org/docs/graalvm-as-a-platform/
https://pxhere.com/en/photo/1067853
DD
Start the launcher with --inspect
Debugger listening on port 9229.
To start debugging, open the following URL in Chrome:
chrome-devtools://devtools/bundled/js_app.html?ws=127.0.0.1:9229/77b52d12-53f20cb0ab35
OO
The Truffle framework has an Instrument API to write other tools, e.g. code
coverage measurement, profilers.
1. Source code-related events
2. Allocation events
3. Language runtime and thread creation events
4. Application execution events
WW
Yes, you can run any language with GraalVM.
... but it may take some time.
It's certainly fun
... and it might even be profitable.
TT
You don't need to write a parser yourself
(and maybe you don't want to, either)
Take time to think about the AST
using a wrong structure leads to hard-to-track bugs
refactoring it later is very hard and time-consuming
@mthmulders #GraalDSL
Q AQ A
Sample code:
Please help conference organisers: don't forget to rate
this talk!
http://bit.ly/brainfuck-jvm

More Related Content

What's hot

37562259 top-consuming-process
37562259 top-consuming-process37562259 top-consuming-process
37562259 top-consuming-process
skumner
 
BOSH deploys distributed systems, and Diego runs any containers
BOSH deploys distributed systems, and Diego runs any containersBOSH deploys distributed systems, and Diego runs any containers
BOSH deploys distributed systems, and Diego runs any containers
Benjamin Gandon
 
GLX, DRI, and i965
GLX, DRI, and i965GLX, DRI, and i965
GLX, DRI, and i965
Chia-I Wu
 
Goroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in GoGoroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in Go
Yu-Shuan Hsieh
 
Comets notes
Comets notesComets notes
Comets notes
Ilija Dukovski
 
我在豆瓣使用Emacs
我在豆瓣使用Emacs我在豆瓣使用Emacs
我在豆瓣使用Emacs
董 伟明
 
Containers for sysadmins
Containers for sysadminsContainers for sysadmins
Containers for sysadmins
Carlos de Alfonso Laguna
 
Note
NoteNote
Apache Hadoop for System Administrators
Apache Hadoop for System AdministratorsApache Hadoop for System Administrators
Apache Hadoop for System Administrators
Allen Wittenauer
 
Nginx-lua
Nginx-luaNginx-lua
Move from C to Go
Move from C to GoMove from C to Go
Move from C to Go
Yu-Shuan Hsieh
 
Go memory
Go memoryGo memory
Go memory
jgrahamc
 
From Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOSFrom Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOS
Susan Potter
 
Go Memory
Go MemoryGo Memory
Go Memory
Cloudflare
 
Improving go-git performance
Improving go-git performanceImproving go-git performance
Improving go-git performance
source{d}
 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrency
jgrahamc
 
agri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertoragri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertor
Toshiaki Baba
 
Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming
Cloudflare
 
HAB Software Woes
HAB Software WoesHAB Software Woes
HAB Software Woes
jgrahamc
 
3 rd animation
3 rd animation3 rd animation
3 rd animation
divyalakshmi77
 

What's hot (20)

37562259 top-consuming-process
37562259 top-consuming-process37562259 top-consuming-process
37562259 top-consuming-process
 
BOSH deploys distributed systems, and Diego runs any containers
BOSH deploys distributed systems, and Diego runs any containersBOSH deploys distributed systems, and Diego runs any containers
BOSH deploys distributed systems, and Diego runs any containers
 
GLX, DRI, and i965
GLX, DRI, and i965GLX, DRI, and i965
GLX, DRI, and i965
 
Goroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in GoGoroutine stack and local variable allocation in Go
Goroutine stack and local variable allocation in Go
 
Comets notes
Comets notesComets notes
Comets notes
 
我在豆瓣使用Emacs
我在豆瓣使用Emacs我在豆瓣使用Emacs
我在豆瓣使用Emacs
 
Containers for sysadmins
Containers for sysadminsContainers for sysadmins
Containers for sysadmins
 
Note
NoteNote
Note
 
Apache Hadoop for System Administrators
Apache Hadoop for System AdministratorsApache Hadoop for System Administrators
Apache Hadoop for System Administrators
 
Nginx-lua
Nginx-luaNginx-lua
Nginx-lua
 
Move from C to Go
Move from C to GoMove from C to Go
Move from C to Go
 
Go memory
Go memoryGo memory
Go memory
 
From Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOSFrom Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOS
 
Go Memory
Go MemoryGo Memory
Go Memory
 
Improving go-git performance
Improving go-git performanceImproving go-git performance
Improving go-git performance
 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrency
 
agri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertoragri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertor
 
Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming
 
HAB Software Woes
HAB Software WoesHAB Software Woes
HAB Software Woes
 
3 rd animation
3 rd animation3 rd animation
3 rd animation
 

Similar to Building a DSL with GraalVM (VoxxedDays Luxembourg)

Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
Emanuel Calvo
 
How to go the extra mile on monitoring
How to go the extra mile on monitoringHow to go the extra mile on monitoring
How to go the extra mile on monitoring
Tiago Simões
 
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
DevSecCon
 
Drizzle to MySQL, Stress Free Migration
Drizzle to MySQL, Stress Free MigrationDrizzle to MySQL, Stress Free Migration
Drizzle to MySQL, Stress Free Migration
Andrew Hutchings
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
Soshi Nemoto
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreter
akaptur
 
Penetration Testing for Easy RM to MP3 Converter Application and Post Exploit
Penetration Testing for Easy RM to MP3 Converter Application and Post ExploitPenetration Testing for Easy RM to MP3 Converter Application and Post Exploit
Penetration Testing for Easy RM to MP3 Converter Application and Post Exploit
JongWon Kim
 
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionDEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
Felipe Prado
 
Basicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt applicationBasicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt application
Dinesh Manajipet
 
Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
Vikas Sharma
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 new
Yiwei Ma
 
Keep it simple web development stack
Keep it simple web development stackKeep it simple web development stack
Keep it simple web development stack
Eric Ahn
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Windows Developer
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Vincenzo Iozzo
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
Lorin Hochstein
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG edition
Joshua Thijssen
 
Velocity 2012 - Learning WebOps the Hard Way
Velocity 2012 - Learning WebOps the Hard WayVelocity 2012 - Learning WebOps the Hard Way
Velocity 2012 - Learning WebOps the Hard Way
Cosimo Streppone
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
tomcopeland
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
Jos Boumans
 

Similar to Building a DSL with GraalVM (VoxxedDays Luxembourg) (20)

Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
 
How to go the extra mile on monitoring
How to go the extra mile on monitoringHow to go the extra mile on monitoring
How to go the extra mile on monitoring
 
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
 
Drizzle to MySQL, Stress Free Migration
Drizzle to MySQL, Stress Free MigrationDrizzle to MySQL, Stress Free Migration
Drizzle to MySQL, Stress Free Migration
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreter
 
Penetration Testing for Easy RM to MP3 Converter Application and Post Exploit
Penetration Testing for Easy RM to MP3 Converter Application and Post ExploitPenetration Testing for Easy RM to MP3 Converter Application and Post Exploit
Penetration Testing for Easy RM to MP3 Converter Application and Post Exploit
 
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionDEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
 
Basicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt applicationBasicsof c make and git for a hello qt application
Basicsof c make and git for a hello qt application
 
Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 new
 
Keep it simple web development stack
Keep it simple web development stackKeep it simple web development stack
Keep it simple web development stack
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG edition
 
Velocity 2012 - Learning WebOps the Hard Way
Velocity 2012 - Learning WebOps the Hard WayVelocity 2012 - Learning WebOps the Hard Way
Velocity 2012 - Learning WebOps the Hard Way
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
 

More from Maarten Mulders

What's cooking in Maven? (Devoxx FR)
What's cooking in Maven? (Devoxx FR)What's cooking in Maven? (Devoxx FR)
What's cooking in Maven? (Devoxx FR)
Maarten Mulders
 
Making Maven Marvellous (Devnexus)
Making Maven Marvellous (Devnexus)Making Maven Marvellous (Devnexus)
Making Maven Marvellous (Devnexus)
Maarten Mulders
 
Making Maven Marvellous (Java.il)
Making Maven Marvellous (Java.il)Making Maven Marvellous (Java.il)
Making Maven Marvellous (Java.il)
Maarten Mulders
 
Making Maven Marvellous (JavaZone)
Making Maven Marvellous (JavaZone)Making Maven Marvellous (JavaZone)
Making Maven Marvellous (JavaZone)
Maarten Mulders
 
Dapr: Dinosaur or Developer's Dream? (v1)
Dapr: Dinosaur or Developer's Dream? (v1)Dapr: Dinosaur or Developer's Dream? (v1)
Dapr: Dinosaur or Developer's Dream? (v1)
Maarten Mulders
 
Dapr: Dinosaur or Developer Dream? (J-Fall)
Dapr: Dinosaur or Developer Dream? (J-Fall)Dapr: Dinosaur or Developer Dream? (J-Fall)
Dapr: Dinosaur or Developer Dream? (J-Fall)
Maarten Mulders
 
SSL/TLS for Mortals (Devoxx UK)
SSL/TLS for Mortals (Devoxx UK)SSL/TLS for Mortals (Devoxx UK)
SSL/TLS for Mortals (Devoxx UK)
Maarten Mulders
 
React in 40 minutes (Voxxed Days Romania)
React in 40 minutes (Voxxed Days Romania) React in 40 minutes (Voxxed Days Romania)
React in 40 minutes (Voxxed Days Romania)
Maarten Mulders
 
React in 40 minutes (JCON)
React in 40 minutes (JCON) React in 40 minutes (JCON)
React in 40 minutes (JCON)
Maarten Mulders
 
React in 50 minutes (Bucharest Software Craftsmanship Community)
React in 50 minutes (Bucharest Software Craftsmanship Community)React in 50 minutes (Bucharest Software Craftsmanship Community)
React in 50 minutes (Bucharest Software Craftsmanship Community)
Maarten Mulders
 
React in 50 Minutes (JNation)
 React in 50 Minutes (JNation)  React in 50 Minutes (JNation)
React in 50 Minutes (JNation)
Maarten Mulders
 
SSL/TLS for Mortals (JavaLand)
SSL/TLS for Mortals (JavaLand) SSL/TLS for Mortals (JavaLand)
SSL/TLS for Mortals (JavaLand)
Maarten Mulders
 
Making Maven Marvellous (J-Fall)
Making Maven Marvellous (J-Fall)Making Maven Marvellous (J-Fall)
Making Maven Marvellous (J-Fall)
Maarten Mulders
 
Building a DSL with GraalVM (Oracle Groundbreaker APAC Virtual Tour)
Building a DSL with GraalVM (Oracle Groundbreaker APAC Virtual Tour)Building a DSL with GraalVM (Oracle Groundbreaker APAC Virtual Tour)
Building a DSL with GraalVM (Oracle Groundbreaker APAC Virtual Tour)
Maarten Mulders
 
SSL/TLS for Mortals (Oracle Groundbreaker EMEA Virtual Tour)
SSL/TLS for Mortals (Oracle Groundbreaker EMEA Virtual Tour)SSL/TLS for Mortals (Oracle Groundbreaker EMEA Virtual Tour)
SSL/TLS for Mortals (Oracle Groundbreaker EMEA Virtual Tour)
Maarten Mulders
 
SSL/TLS for Mortals (UtrechtJUG)
SSL/TLS for Mortals (UtrechtJUG)SSL/TLS for Mortals (UtrechtJUG)
SSL/TLS for Mortals (UtrechtJUG)
Maarten Mulders
 
Building a DSL with GraalVM (javaBin online)
Building a DSL with GraalVM (javaBin online)Building a DSL with GraalVM (javaBin online)
Building a DSL with GraalVM (javaBin online)
Maarten Mulders
 
SSL/TLS for Mortals (Lockdown Lecture)
SSL/TLS for Mortals (Lockdown Lecture)SSL/TLS for Mortals (Lockdown Lecture)
SSL/TLS for Mortals (Lockdown Lecture)
Maarten Mulders
 
React in 50 Minutes (OpenValue)
React in 50 Minutes (OpenValue) React in 50 Minutes (OpenValue)
React in 50 Minutes (OpenValue)
Maarten Mulders
 
React in 50 Minutes (DevNexus)
React in 50 Minutes (DevNexus) React in 50 Minutes (DevNexus)
React in 50 Minutes (DevNexus)
Maarten Mulders
 

More from Maarten Mulders (20)

What's cooking in Maven? (Devoxx FR)
What's cooking in Maven? (Devoxx FR)What's cooking in Maven? (Devoxx FR)
What's cooking in Maven? (Devoxx FR)
 
Making Maven Marvellous (Devnexus)
Making Maven Marvellous (Devnexus)Making Maven Marvellous (Devnexus)
Making Maven Marvellous (Devnexus)
 
Making Maven Marvellous (Java.il)
Making Maven Marvellous (Java.il)Making Maven Marvellous (Java.il)
Making Maven Marvellous (Java.il)
 
Making Maven Marvellous (JavaZone)
Making Maven Marvellous (JavaZone)Making Maven Marvellous (JavaZone)
Making Maven Marvellous (JavaZone)
 
Dapr: Dinosaur or Developer's Dream? (v1)
Dapr: Dinosaur or Developer's Dream? (v1)Dapr: Dinosaur or Developer's Dream? (v1)
Dapr: Dinosaur or Developer's Dream? (v1)
 
Dapr: Dinosaur or Developer Dream? (J-Fall)
Dapr: Dinosaur or Developer Dream? (J-Fall)Dapr: Dinosaur or Developer Dream? (J-Fall)
Dapr: Dinosaur or Developer Dream? (J-Fall)
 
SSL/TLS for Mortals (Devoxx UK)
SSL/TLS for Mortals (Devoxx UK)SSL/TLS for Mortals (Devoxx UK)
SSL/TLS for Mortals (Devoxx UK)
 
React in 40 minutes (Voxxed Days Romania)
React in 40 minutes (Voxxed Days Romania) React in 40 minutes (Voxxed Days Romania)
React in 40 minutes (Voxxed Days Romania)
 
React in 40 minutes (JCON)
React in 40 minutes (JCON) React in 40 minutes (JCON)
React in 40 minutes (JCON)
 
React in 50 minutes (Bucharest Software Craftsmanship Community)
React in 50 minutes (Bucharest Software Craftsmanship Community)React in 50 minutes (Bucharest Software Craftsmanship Community)
React in 50 minutes (Bucharest Software Craftsmanship Community)
 
React in 50 Minutes (JNation)
 React in 50 Minutes (JNation)  React in 50 Minutes (JNation)
React in 50 Minutes (JNation)
 
SSL/TLS for Mortals (JavaLand)
SSL/TLS for Mortals (JavaLand) SSL/TLS for Mortals (JavaLand)
SSL/TLS for Mortals (JavaLand)
 
Making Maven Marvellous (J-Fall)
Making Maven Marvellous (J-Fall)Making Maven Marvellous (J-Fall)
Making Maven Marvellous (J-Fall)
 
Building a DSL with GraalVM (Oracle Groundbreaker APAC Virtual Tour)
Building a DSL with GraalVM (Oracle Groundbreaker APAC Virtual Tour)Building a DSL with GraalVM (Oracle Groundbreaker APAC Virtual Tour)
Building a DSL with GraalVM (Oracle Groundbreaker APAC Virtual Tour)
 
SSL/TLS for Mortals (Oracle Groundbreaker EMEA Virtual Tour)
SSL/TLS for Mortals (Oracle Groundbreaker EMEA Virtual Tour)SSL/TLS for Mortals (Oracle Groundbreaker EMEA Virtual Tour)
SSL/TLS for Mortals (Oracle Groundbreaker EMEA Virtual Tour)
 
SSL/TLS for Mortals (UtrechtJUG)
SSL/TLS for Mortals (UtrechtJUG)SSL/TLS for Mortals (UtrechtJUG)
SSL/TLS for Mortals (UtrechtJUG)
 
Building a DSL with GraalVM (javaBin online)
Building a DSL with GraalVM (javaBin online)Building a DSL with GraalVM (javaBin online)
Building a DSL with GraalVM (javaBin online)
 
SSL/TLS for Mortals (Lockdown Lecture)
SSL/TLS for Mortals (Lockdown Lecture)SSL/TLS for Mortals (Lockdown Lecture)
SSL/TLS for Mortals (Lockdown Lecture)
 
React in 50 Minutes (OpenValue)
React in 50 Minutes (OpenValue) React in 50 Minutes (OpenValue)
React in 50 Minutes (OpenValue)
 
React in 50 Minutes (DevNexus)
React in 50 Minutes (DevNexus) React in 50 Minutes (DevNexus)
React in 50 Minutes (DevNexus)
 

Recently uploaded

Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
Jhone kinadey
 
Kubernetes at Scale: Going Multi-Cluster with Istio
Kubernetes at Scale:  Going Multi-Cluster  with IstioKubernetes at Scale:  Going Multi-Cluster  with Istio
Kubernetes at Scale: Going Multi-Cluster with Istio
Severalnines
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLESINTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
anfaltahir1010
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
ervikas4
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
OnePlan Solutions
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
Massimo Artizzu
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
Maitrey Patel
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
Reetu63
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 

Recently uploaded (20)

Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
 
Kubernetes at Scale: Going Multi-Cluster with Istio
Kubernetes at Scale:  Going Multi-Cluster  with IstioKubernetes at Scale:  Going Multi-Cluster  with Istio
Kubernetes at Scale: Going Multi-Cluster with Istio
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLESINTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...Transforming Product Development using OnePlan To Boost Efficiency and Innova...
Transforming Product Development using OnePlan To Boost Efficiency and Innova...
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 

Building a DSL with GraalVM (VoxxedDays Luxembourg)

  • 1. B DSLB DSL G VMG VM M MM M
  • 2. D S LD S L https://pxhere.com/en/photo/1057524
  • 3. SELECT country, COUNT(1) AS count FROM Customer GROUP BY country;
  • 4. Given my account has a balance of € 430 When I receive a money transfer of € 500 Then my account should have a balance of € 930
  • 5. Setup( Boat on StartingShore, Wolf on StartingShore, Sheep on StartingShore, Cabbage on StartingShore ) execute ( Boat move Cabbage to StartingShore, Boat move Sheep to DestinationShore, Boat move None to StartingShore, Boat move Cabbage to DestinationShore, Boat move Sheep to StartingShore, Boat move Wolf to DestinationShore, Boat move None to StartingShore, Boat move Sheep to DestinationShore ) https://github.com/NRBPerdijk/dsl-for-the-dense/
  • 6. + + > + + + + + [ < + > - ] + + + + + + + + [ < + + + + + + > - ] < .
  • 7. BB This program adds the numbers 2 and 5 + + Store the number 2 in the first slot > + + + + + Store the number 5 in the second slot [ Move back and forth between first and second slot < + > - While "moving" ones from the second to the first slot ] The first slot now has '7' in it but we need to output the ASCII value for that The ASCII value is 48 higher than the number we have The second slot is now empty It will act as a counter so we can add 6 * 8 to the first slot + + + + + + + + Store 8 in it [ Again move back and forth between first and second slot < + + + + + + while adding 6 to the first slot > - before reducing the counter in the second slot ] < . Go back to the first slot and print it
  • 8. 0 1 2 3 4 ... 29 997 29 998 29 999 2 5 3 0 0 0 0 0 ↑
  • 9. command meaning + increase value - decrease value . print value to std out , read one byte from std in [ if value eq 0, jump after matching ] ] if value neq 0, jump after matching [ < move pointer left > move pointer right
  • 12. G VMG VM “One VM to rule them all cc-by-sa/2.0 - © Lairich Rig - https://www.geograph.org.uk/photo/3203827
  • 13.
  • 14. BB yapi.bf calculating 15 digits of π Runtime Average time (s/op) Error Java HotSpot(TM) 64-Bit Server VM 0.053 ± 0.001 OpenJDK GraalVM CE 19.0.0 0.045 ± 0.001 All tests are ran on an 2018 MacBook Pro with 2.6 GHz Intel Core i7 and 16 GB 2400 MHz DDR4. The machine runs macOS Mojave 10.14.4 and JDK 1.8.0_212. Tests measured with . Each test ran 5 times with 5 warmup iterations.jmh
  • 15. BB yapi.bf calculating 45 digits of π Runtime Average time (s/op) Error Java HotSpot(TM) 64-Bit Server VM 0.207 ± 0.002 OpenJDK GraalVM CE 19.0.0 0.185 ± 0.003 All tests are ran on an 2018 MacBook Pro with 2.6 GHz Intel Core i7 and 16 GB 2400 MHz DDR4. The machine runs macOS Mojave 10.14.4 and JDK 1.8.0_212. Tests measured with . Each test ran 5 times with 5 warmup iterations.jmh
  • 16. TT cc-by-sa/2.5 - © Darvin DeShazer - https://mushroomobserver.org/2538 “open source library for building programming language implementations as interpreters for self-modifying Abstract Syntax Trees.
  • 17. A S TA S T ROOT INCR_VAL INCR_VAL INCR_VAL INCR_VAL INCR_VAL JUMP INCR_VAL INCR_VAL DECR_PTR INCR_VAL INCR_PTR DECR_VAL (part of the program that adds 5 and 2)
  • 19. P EP E Calculate for positive integers If we know that , the program becomes simpler: x n f (x, n) = ⎧ ⎩ ⎨ ⎪ ⎪ 1 ,(f (x, 0.5 ∗ n)) 2 x ∗ f (x, n − 1), if n = 0 if n is even otherwise n = 5 f (x) = x ∗ ( )x 2 2
  • 21. BB @Override public void execute(final VirtualFrame frame) { final int currentValue = someCalculation(); doPrint(getContext().getOutput(), (char) currentValue); } @TruffleBoundary private void doPrint(final PrintWriter out, final char value) { out.print(value); out.flush(); }
  • 23. SS @Specialization(guards = "b 0") public double divide(int a, int b) { return a / b; }
  • 24. SS @Specialization(rewriteOn = ArithmeticException.class) int doAddNoOverflow(int a, int b) { return Math.addExact(a, b); } @Specialization long doAddWithOverflow(int a, int b) { return a + b; } execute(Integer.MAX_VALUE - 1, 1) doAddNoOverflow(Integer.MAX_VALUE - 1, 1) execute(Integer.MAX_VALUE , 1) doAddNoOverflow(Integer.MAX_VALUE, 1) throws ArithmeticException doAddWithOverflow(Integer.MAX_VALUE, 1) execute(Integer.MAX_VALUE - 1, 1) doAddWithOverflow(Integer.MAX_VALUE - 1, 1)
  • 25. W G VM JVMW G VM JVM function abs (int i) if ( we saw only positive integers in the input ) { return i; } else { transferToInterpreterAndInvalidate; return i < 0 ? i : i; } }
  • 27.
  • 28. LL Converts a sequence of characters into a sequence of tokens.
  • 29. PP Converts a sequence of tokens into (hierarchical) data structure.
  • 30. P LP L 1. Write some regular expressions 2. Use a parser generator (like )ANTLR cc-by-nc/2.5 - © Randall Munroe - https://www.xkcd.com/1171/
  • 31. II
  • 32. G VM UG VM U GraalVM comes with the GraalVM Updater (gu) Use gu to install components, such as language packs or tools. e.g. gu install native-image gu -L install brainfuck component-0.1-SNAPSHOT.jar
  • 33. CC Distribute your language implementation as a component: $ tree . ├── META-INF │ ├── MANIFEST.MF │ ├── permissions │ └── symlinks └── jre └── languages └── bf ├── bin │ └── bf ├── brainfuck.jar └── launcher └── bf launcher.jar 6 directories, 6 files
  • 34. UU 1. Prepare source code 2. Prepare GraalVM polyglot context 3. Evaluate the source code input = "+ + > + + + + + [ < + > - ] + + + + + + + + [ < + + + + + + > - ] < ."; source = Source.newBuilder("bf", input, "user input").build(); output = new ByteArrayOutputStream(); context = Context.newBuilder("bf").out(output).build(); context.eval(source); System.out.println(output.toString());
  • 35. TT “Implementing your own language using GraalVM will not only give you high performance. More importantly, it allows your language to connect with the rich tooling provided by the GraalVM ecosystem. https://www.graalvm.org/docs/graalvm-as-a-platform/ https://pxhere.com/en/photo/1067853
  • 36. DD Start the launcher with --inspect Debugger listening on port 9229. To start debugging, open the following URL in Chrome: chrome-devtools://devtools/bundled/js_app.html?ws=127.0.0.1:9229/77b52d12-53f20cb0ab35
  • 37.
  • 38. OO The Truffle framework has an Instrument API to write other tools, e.g. code coverage measurement, profilers. 1. Source code-related events 2. Allocation events 3. Language runtime and thread creation events 4. Application execution events
  • 39. WW Yes, you can run any language with GraalVM. ... but it may take some time. It's certainly fun ... and it might even be profitable.
  • 40. TT You don't need to write a parser yourself (and maybe you don't want to, either) Take time to think about the AST using a wrong structure leads to hard-to-track bugs refactoring it later is very hard and time-consuming
  • 41. @mthmulders #GraalDSL Q AQ A Sample code: Please help conference organisers: don't forget to rate this talk! http://bit.ly/brainfuck-jvm