SlideShare a Scribd company logo
1 of 15
Download to read offline
JavaScript for VW Applica1ons 
JavaScript 
for 
VW 
Applica1ons 
Holger 
Kleinsorgen 
& 
Jan 
Schümmer 
intelligent 
views, 
Darmstadt, 
Germany 
ESUG 
2014 
– 
Cambridge, 
UK
JavaScript for VW Applica1ons 
K-­‐Infinity 
-­‐ 
our 
core 
product 
2 
• semanJc 
database 
• modelling 
• querying 
• data 
integraJon 
• web 
frontend 
(Java) 
• REST 
services 
• highly 
configurable 
à 
need 
for 
scrip1ng 
throughout 
the 
system
JavaScript for VW Applica1ons 
3 
Smalltalk 
sandbox 
J 
J 
K 
J 
J 
JavaScript 
JJ 
J 
JJ 
J 
J 
First 
try: 
KScript 
easy 
to 
communicate 
L 
easy 
to 
learn 
L 
universal 
/ 
wide 
spread 
LL 
suitable 
K 
flexible 
L
JavaScript for VW Applica1ons 
Anything 
reusable 
out 
there? 
4 
only 
one 
dead 
ST 
implementaJon 
3rd 
party 
C 
libraries 
• Jed 
to 
web 
environments 
• uncertain 
future 
Mozilla 
Rhino 
• Java 
implementaJon 
would 
need 
JNI 
• lack 
of 
flexibility 
for 
host 
object 
integraJon 
We 
wanted 
real 
Smalltalk 
Objects 
without 
addiJonal 
runJmes
JavaScript for VW Applica1ons 
5 
What 
is 
important? 
• conform 
to 
the 
specs 
• easy 
to 
integrate 
host 
objects 
• maintainable 
What 
is 
not 
that 
important 
• performance 
à 
simply 
follow 
the 
250 
pages 
of 
the 
ECMA 
5 
spec
JavaScript for VW Applica1ons 
Parser 
6 
• PeJtParser 
• PEG 
+ 
Memoizing 
+ 
Stuff, 
Smalltalk 
notaJon 
• Tweaked 
for 
more 
precise 
error 
locaJons 
• separated 
into 
lexical 
and 
syntacJcal 
part 
• follows 
structure 
of 
ECMA 
spec 
• adapted 
for 
PEG 
(no 
lec 
recursions, 
alternaJves 
parse 
first 
match) 
• quirks 
due 
to 
spec 
• strict 
mode 
• disJnguish 
regex 
literals 
from 
expressions 
• automaJc 
semicolon 
inserJon
JavaScript for VW Applica1ons 
Parser 
7
JavaScript for VW Applica1ons 
RunJme 
8 
• Everything 
represented 
by 
dedicated 
objects 
• JSEAbstractObject 
(Javascript 
objects 
and 
primiJves) 
• JSEExecuJonEnvironment 
+ 
JSEExecuJonContext 
• JSEBinding, 
JSEReference, 
JSEProperty 
• Implement 
algorithms 
of 
the 
spec 
• VW 
VM 
garbage 
collecJon 
• Language 
core 
implemented 
by 
JSERunJmeImplementaJon 
• Syntax 
tree 
transformed 
to 
code 
blocks 
• Code 
blocks 
are 
evaluated 
in 
an 
execuJon 
context 
• Interpreted 
and 
thus 
quite 
slow
JavaScript for VW Applica1ons 
9 
ECMAScript 
Language 
Specifica1on 
5.1, 
page 
76
JavaScript for VW Applica1ons 
ECMA 
conformance 
test 
suite 
10 
• about 
11500 
unit 
tests 
• current 
result: 
313 
failures, 
95 
errors 
(4 
%) 
• browsers: 
between 
8 
and 
52 
failures 
/ 
errors 
(0.06 
% 
– 
0.45 
%) 
• test 
cases 
helped 
to 
find 
the 
nicy 
/ 
exoJc 
parts 
• decided 
to 
accept 
some 
failures 
for 
the 
Jme 
being
JavaScript for VW Applica1ons 
11 
Demo 
1me
JavaScript for VW Applica1ons 
K-­‐Infinity 
IntegraJon 
12 
Usage 
Example 
• definiJon 
of 
a 
REST 
service 
SemanJc 
Net 
API 
Debugger
JavaScript for VW Applica1ons 
Ups 
and 
Downs 
13 
The 
good 
parts 
• (mostly) 
works 
as 
expected 
• implementaJon 
was 
straight 
forward 
• use 
cool 
JS 
libraries 
• fast 
enough 
for 
our 
use 
cases 
The 
cheesy 
parts 
• parser 
hacks 
• the 
"usual" 
browser 
objects 
are 
not 
available 
• took 
some 
Jme
JavaScript for VW Applica1ons 
Wish 
list 
14 
• switch 
to 
single 
grammar 
• switch 
to 
VW 
PEG 
Parser 
• nicer 
to 
read 
due 
to 
DSL, 
easier 
to 
maintain 
• already 
includes 
JS 
grammar, 
needs 
some 
tweaks 
though 
• byte 
code 
compiler 
• only 
as 
a 
pet 
project, 
not 
required 
currently 
• all 
test 
cases 
pass 
• ECMA 
6 
(especially 
collecJons)
JavaScript for VW Applica1ons 
15 
JavascriptEngine-­‐Bundle 
MIT 
License 
Public 
Repository 
{h.kleinsorgen|j.schuemmer}@i-­‐views.de 
Thank 
you 
for 
your 
aRen1on

More Related Content

More from ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 

More from ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Recently uploaded

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 

Recently uploaded (20)

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 

JavaScript for VW Applications

  • 1. JavaScript for VW Applica1ons JavaScript for VW Applica1ons Holger Kleinsorgen & Jan Schümmer intelligent views, Darmstadt, Germany ESUG 2014 – Cambridge, UK
  • 2. JavaScript for VW Applica1ons K-­‐Infinity -­‐ our core product 2 • semanJc database • modelling • querying • data integraJon • web frontend (Java) • REST services • highly configurable à need for scrip1ng throughout the system
  • 3. JavaScript for VW Applica1ons 3 Smalltalk sandbox J J K J J JavaScript JJ J JJ J J First try: KScript easy to communicate L easy to learn L universal / wide spread LL suitable K flexible L
  • 4. JavaScript for VW Applica1ons Anything reusable out there? 4 only one dead ST implementaJon 3rd party C libraries • Jed to web environments • uncertain future Mozilla Rhino • Java implementaJon would need JNI • lack of flexibility for host object integraJon We wanted real Smalltalk Objects without addiJonal runJmes
  • 5. JavaScript for VW Applica1ons 5 What is important? • conform to the specs • easy to integrate host objects • maintainable What is not that important • performance à simply follow the 250 pages of the ECMA 5 spec
  • 6. JavaScript for VW Applica1ons Parser 6 • PeJtParser • PEG + Memoizing + Stuff, Smalltalk notaJon • Tweaked for more precise error locaJons • separated into lexical and syntacJcal part • follows structure of ECMA spec • adapted for PEG (no lec recursions, alternaJves parse first match) • quirks due to spec • strict mode • disJnguish regex literals from expressions • automaJc semicolon inserJon
  • 7. JavaScript for VW Applica1ons Parser 7
  • 8. JavaScript for VW Applica1ons RunJme 8 • Everything represented by dedicated objects • JSEAbstractObject (Javascript objects and primiJves) • JSEExecuJonEnvironment + JSEExecuJonContext • JSEBinding, JSEReference, JSEProperty • Implement algorithms of the spec • VW VM garbage collecJon • Language core implemented by JSERunJmeImplementaJon • Syntax tree transformed to code blocks • Code blocks are evaluated in an execuJon context • Interpreted and thus quite slow
  • 9. JavaScript for VW Applica1ons 9 ECMAScript Language Specifica1on 5.1, page 76
  • 10. JavaScript for VW Applica1ons ECMA conformance test suite 10 • about 11500 unit tests • current result: 313 failures, 95 errors (4 %) • browsers: between 8 and 52 failures / errors (0.06 % – 0.45 %) • test cases helped to find the nicy / exoJc parts • decided to accept some failures for the Jme being
  • 11. JavaScript for VW Applica1ons 11 Demo 1me
  • 12. JavaScript for VW Applica1ons K-­‐Infinity IntegraJon 12 Usage Example • definiJon of a REST service SemanJc Net API Debugger
  • 13. JavaScript for VW Applica1ons Ups and Downs 13 The good parts • (mostly) works as expected • implementaJon was straight forward • use cool JS libraries • fast enough for our use cases The cheesy parts • parser hacks • the "usual" browser objects are not available • took some Jme
  • 14. JavaScript for VW Applica1ons Wish list 14 • switch to single grammar • switch to VW PEG Parser • nicer to read due to DSL, easier to maintain • already includes JS grammar, needs some tweaks though • byte code compiler • only as a pet project, not required currently • all test cases pass • ECMA 6 (especially collecJons)
  • 15. JavaScript for VW Applica1ons 15 JavascriptEngine-­‐Bundle MIT License Public Repository {h.kleinsorgen|j.schuemmer}@i-­‐views.de Thank you for your aRen1on