SlideShare une entreprise Scribd logo
1  sur  44
Télécharger pour lire hors ligne
A visual DSL toolkit in Lua
Past, present and future

Alexander Gladysh <ag@logiceditor.com>

Lua Workshop 2013
Toulouse
1 / 44
Outline
Introduction
The Problem
Classic third-party alternatives
Past generations
The present generation
The future
Questions?

2 / 44
Alexander Gladysh

CTO, co-founder at LogicEditor
In löve with Lua since 2005

3 / 44
LogicEditor

Use Lua to develop:
Visual DSL toolkit (subject of this talk)
Big-data analytics
Intensive-load web-services
In-browser and mobile games

600+ KLOC of private Lua codebase
Some contributions to open-source Lua projects

4 / 44
The Problem

Business-logic is highly volatile.
Programmers are not domain area specialists.
Specialist ⇔ Manager ⇔ Programmer loop is slow.
Specialist ⇔ Programmer loop is expensive.
Let specialists do the business-logic!

5 / 44
6 / 44
Non-programmers aren’t programmers

It is not enough to be able to compose an algorithm and even
implement it with some simple programming language.
For commercial programming you’ll also need, at least:
Technical background
Debugging skills
Team coding skills

7 / 44
Solution

A tool that prevents technical mistakes
While limiting creativity as little as possible
And is within grasp of a non-programmer.

8 / 44
Ad-hoc implementations

One-shot, very limited flexibility
Full of crutches
Hard to maintain

9 / 44
Classic third-party alternatives

10 / 44
MIT Scratch

11 / 44
Descent Freespace Editor Events

12 / 44
Lego NXT-G

13 / 44
Apple Automator

14 / 44
What is in common?

A visual domain-specific language,
that allows user to describe
the control-flow.

15 / 44
A retrospective of ideas

Screenshots shown here are from editors done by me and/or my
colleagues for different companies we worked for, over time.
Only an idea was re-used and improved between generations.

16 / 44
Video-adventure game editor

(No screenshots available)
Legacy, circa 2002—2004
Graph of in-game dialog remarks and answer choices
Allowing to tie-in video-loop to remark
No Lua.

17 / 44
Adventure game dialog editor, I, II

Graph of in-game dialog remarks and answer choices
With ability to add custom Lua code logic (in II)
Generated data (in Lua) for a state machine (also in Lua)

18 / 44
Browser MMO quest editor, I, II

19 / 44
Browser MMO magic system editor

20 / 44
Analysis

Some non-programmers prefer visual control-flow editors.
Some — textual representation.
(Programmers hate to use both kinds.)
All editors were very useful, some — invaluable.
But, in retrospective, some should have been replaced by
dedicated coders.
None of the past-generation editors were flexible enough to be
used outside its immediate domain (but this never was an
official goal for them).

21 / 44
The Visual Business Logic Editor Toolkit

22 / 44
Design goals

Easy to create new editors.
Easy to support existing editors.
Easy to integrate with "any" other project on "any"
technology.
Easy enough to learn and use by end-users.

23 / 44
Editor use-cases

For example:
A dialog editor for a game scenario writer.
A magic system editor for a game-designer.
A mission logic editor for a game level-designer.
A DB query editor for a data analyst (Hadoop, anyone?).
An advertising campaign targeting editor for a marketer.
...and so on.

24 / 44
Technology

The data is a tree corresponding to the control flow (or to
anything tree-like, actually).
The output is structured text (code or data).
Editor code, UI and backend, is generated by Lua code in the
Toolkit, from the data "schema".
Editor UI is in JavaScript / HTML, backend is in Lua.

25 / 44
The Data Schema

Embedded Lua DSL (see my talk on Lua WS’11).
http://bit.ly/lua-dsl-talk
Describes how to:
check data validity,
generate default data,
render data to editor UI,
change data in editor UI,
render the conforming data to the output code (or data).

Two layers: human-friendly and machine-friendly

26 / 44
Schema Example, I

See also: http://bit.ly/le7-schema
lang:root "lua.print-string"
lang:value "lua.string.value" {
data_type = "string";
default = "Hallo, world!";
render:js [[String Value]] { [[${1}]] };
render:lua { [[${1}]] };
}

27 / 44
Schema Example, II

lang:func "lua.print-string" {
"lua.string.value";
render:js [[Print string]] {
[[Print: ${1}]];
};
render:lua {
[[print(${1})]];
};
}

28 / 44
Default Data

{
id = "lua.print-string";
{
id = "lua.string.value";
"Hallo, world!";
}
}
Renders to Lua as:
print("Hallo, world!")

29 / 44
UI for default data (simplified)

<div id="lua.print-string">
Print: <span id="lua.string.value">Hallo, world!</span>
</div>
NB: That <span> turns to edit-box on click.

30 / 44
Extending string type

lang:type "lua.string" {
init = "lua.string.value";
render:js [[String]] { menu = [[S]]; [[${1}]] };
render:lua { [[${1}]] };
}
lang:func "lua.string.reverse" {
type = "lua.string";
render:js [[Reverse string]] { [[Reverse: ${1}]] };
render:lua { [[(${1}):reverse()]] };
}

31 / 44
Print with multiple arguments
lang:list "lua.print"
{
"lua.string";
render:js [[Print]] {
empty = [[Print newline]];
before = [[Print values: <ul><li>]];
glue = [[</li><li>]];
after = [[</li></ul>]];
};
render:lua {
before = [[print(]];
glue = [[,]];
after = [[)]];
};
}
32 / 44
Main primitives

lang:const
lang:value
lang:enum
lang:func
lang:list
lang:type

33 / 44
Machine-friendly schema

node:literal
node:variant
node:record
node:value
node:list

34 / 44
Data-upgrade routines

A set of hooks for data tree traversal.
Transformations between two given data versions.
In terms of node schema.
Semi-automatic, template code is generated.

35 / 44
What else?

Scopes in the schema.
External and internal data-sources.

36 / 44
Several points of improvement

Current generation does its job well, but we see several ways on
how to make it better
Several points to improve
Better, modern HTML (at the cost of support of IE6).
Lua in browser for a server-less integration option.
Even more flexible and expressive Schema DSL.
NB: We’ll probably go for a control-flow diagram UI first, not
text-based one (current text-based is cool enough).

37 / 44
Problems with the current DSL

One language for three separate concepts:
data tree structure,
editor UI,
final output.

Data tree structure gets a bit synthetic and convoluted at
times.
Should be easier to add alternative editor UIs.

38 / 44
Solution

Three separate sets of languages:
data tree format,
render to output (per output format),
render to editor (per editor kind).

CSS-like rules instead of pre-defined set of node types

39 / 44
Early examples
http://bit.ly/le8-proto
data:root "script"
data:type "script" ("*", "action")
data:type "action" "print-var" "var-name"
to:text "script" :T [[
local _VARS = {}
${indent(concat(children))}
]]
to:text "print-var" "var-name"
:T [[print(_VARS[${quote:lua(node)}])]]
to:ui "print-var" "var-name"
:T [[Print: ${child(1)})]]

40 / 44
An alternative approach to the Embedded DSLs in Lua

foo:bar "baz" { "quo" }
local
proxy
proxy
proxy

proxy = foo
= proxy["bar"]
= proxy(foo, "baz")
= proxy({ "quo" })

41 / 44
The FSM

foo:bar "baz" { "quo" }
If proxy is as a FSM, indexes and calls — state transitions.
INIT | index "bar" -> foo.bar
foo.bar | call -> foo.bar.name
foo.bar.name | call -> foo.bar.name.param
FINAL <- foo.bar.name.param
Early working prototype: http://bit.ly/le-dsl-fsm.

42 / 44
Easier to code complex DSL constructs
play:scene [[SCENE II]]
.location [[Another room in the castle.]]
:enter "HAMLET"
:remark "HAMLET" [[
Safely stowed.
]]
:remark { "ROSENCRANTZ", "GILDERSTERN" }
.cue [[within]] [[
Hamlet! Lord Hamlet!
]]
:remark "HAMLET" [[
What noise? who calls on Hamlet?
O, here they come.
]]

43 / 44
Questions?

Alexander Gladysh, ag@logiceditor.com

44 / 44

Contenu connexe

En vedette (20)

A Holistic Approach to Institutional ORCID Implementation
A Holistic Approach to Institutional ORCID ImplementationA Holistic Approach to Institutional ORCID Implementation
A Holistic Approach to Institutional ORCID Implementation
 
Patrice Krupa - Short Sale Homeowner Presentation
Patrice Krupa - Short Sale Homeowner PresentationPatrice Krupa - Short Sale Homeowner Presentation
Patrice Krupa - Short Sale Homeowner Presentation
 
Experience
ExperienceExperience
Experience
 
Presentazione Istituto Pantheon
Presentazione Istituto PantheonPresentazione Istituto Pantheon
Presentazione Istituto Pantheon
 
Adventures of Professor Bear
Adventures of Professor BearAdventures of Professor Bear
Adventures of Professor Bear
 
Diadelosmuertos
DiadelosmuertosDiadelosmuertos
Diadelosmuertos
 
Investor Relations 2.0
Investor Relations 2.0Investor Relations 2.0
Investor Relations 2.0
 
Old Jobs
Old JobsOld Jobs
Old Jobs
 
Office2007
Office2007Office2007
Office2007
 
Horse and Mulepower
Horse and MulepowerHorse and Mulepower
Horse and Mulepower
 
PRESIMETRICS
PRESIMETRICSPRESIMETRICS
PRESIMETRICS
 
Presentation2
Presentation2Presentation2
Presentation2
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
1. ip touch introduction 1
1. ip touch introduction 11. ip touch introduction 1
1. ip touch introduction 1
 
Cny70
Cny70Cny70
Cny70
 
Marshall Intro09
Marshall Intro09Marshall Intro09
Marshall Intro09
 
De castro sonex work group
De castro sonex work groupDe castro sonex work group
De castro sonex work group
 
Meet Christian Farioli
Meet Christian FarioliMeet Christian Farioli
Meet Christian Farioli
 
Gerenciamento da configuração
Gerenciamento da configuraçãoGerenciamento da configuração
Gerenciamento da configuração
 
ABA Tax Aspects in Austria
ABA Tax Aspects in AustriaABA Tax Aspects in Austria
ABA Tax Aspects in Austria
 

Similaire à A visual DSL toolkit in Lua: Past, present and future

49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdfcNguyn506241
 
Pragmatic Model Driven Development using openArchitectureWare
Pragmatic Model Driven Development using openArchitectureWarePragmatic Model Driven Development using openArchitectureWare
Pragmatic Model Driven Development using openArchitectureWareMichael Vorburger
 
Introduction to basics of drupal
Introduction to basics of drupalIntroduction to basics of drupal
Introduction to basics of drupallrtraining05
 
NoSQL and Hadoop: A New Generation of Databases - Changing the Game: Monthly ...
NoSQL and Hadoop: A New Generation of Databases - Changing the Game: Monthly ...NoSQL and Hadoop: A New Generation of Databases - Changing the Game: Monthly ...
NoSQL and Hadoop: A New Generation of Databases - Changing the Game: Monthly ...Capgemini
 
Elyra - a set of AI-centric extensions to JupyterLab Notebooks.
Elyra - a set of AI-centric extensions to JupyterLab Notebooks.Elyra - a set of AI-centric extensions to JupyterLab Notebooks.
Elyra - a set of AI-centric extensions to JupyterLab Notebooks.Luciano Resende
 
13 - Panorama Necto 14 building models - visualization & data discovery solu...
13  - Panorama Necto 14 building models - visualization & data discovery solu...13  - Panorama Necto 14 building models - visualization & data discovery solu...
13 - Panorama Necto 14 building models - visualization & data discovery solu...Panorama Software
 
A Project Report on Insurance System with Tracking Manager
 A Project Report on Insurance System with Tracking Manager  A Project Report on Insurance System with Tracking Manager
A Project Report on Insurance System with Tracking Manager Sachin Kariyattin
 
198970820 p-oooooooooo
198970820 p-oooooooooo198970820 p-oooooooooo
198970820 p-oooooooooohomeworkping4
 
Toad for-oracle-release-notes 142
Toad for-oracle-release-notes 142Toad for-oracle-release-notes 142
Toad for-oracle-release-notes 142MrFrancito777
 
Drupal Overview For Techies
Drupal Overview For TechiesDrupal Overview For Techies
Drupal Overview For TechiesRobert Carr
 
Philipe Riand - Building Social Applications using the Social Business Toolki...
Philipe Riand - Building Social Applications using the Social Business Toolki...Philipe Riand - Building Social Applications using the Social Business Toolki...
Philipe Riand - Building Social Applications using the Social Business Toolki...LetsConnect
 
A Quick Look at Drupal
A Quick Look at DrupalA Quick Look at Drupal
A Quick Look at Drupalsheenadonnelly
 
Copmuter Languages
Copmuter LanguagesCopmuter Languages
Copmuter Languagesactanimation
 
Synapse india fundamentals of dotnet development
Synapse india fundamentals of dotnet  developmentSynapse india fundamentals of dotnet  development
Synapse india fundamentals of dotnet developmentSynapseindiappsdevelopment
 

Similaire à A visual DSL toolkit in Lua: Past, present and future (20)

49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
49.INS2065.Computer Based Technologies.TA.NguyenDucAnh.pdf
 
Drupal
DrupalDrupal
Drupal
 
Pragmatic Model Driven Development using openArchitectureWare
Pragmatic Model Driven Development using openArchitectureWarePragmatic Model Driven Development using openArchitectureWare
Pragmatic Model Driven Development using openArchitectureWare
 
Toad
ToadToad
Toad
 
Introduction to basics of drupal
Introduction to basics of drupalIntroduction to basics of drupal
Introduction to basics of drupal
 
NoSQL and Hadoop: A New Generation of Databases - Changing the Game: Monthly ...
NoSQL and Hadoop: A New Generation of Databases - Changing the Game: Monthly ...NoSQL and Hadoop: A New Generation of Databases - Changing the Game: Monthly ...
NoSQL and Hadoop: A New Generation of Databases - Changing the Game: Monthly ...
 
Elyra - a set of AI-centric extensions to JupyterLab Notebooks.
Elyra - a set of AI-centric extensions to JupyterLab Notebooks.Elyra - a set of AI-centric extensions to JupyterLab Notebooks.
Elyra - a set of AI-centric extensions to JupyterLab Notebooks.
 
13 - Panorama Necto 14 building models - visualization & data discovery solu...
13  - Panorama Necto 14 building models - visualization & data discovery solu...13  - Panorama Necto 14 building models - visualization & data discovery solu...
13 - Panorama Necto 14 building models - visualization & data discovery solu...
 
Final ppt
Final pptFinal ppt
Final ppt
 
A Project Report on Insurance System with Tracking Manager
 A Project Report on Insurance System with Tracking Manager  A Project Report on Insurance System with Tracking Manager
A Project Report on Insurance System with Tracking Manager
 
Software Development with PHP & Laravel
Software Development  with PHP & LaravelSoftware Development  with PHP & Laravel
Software Development with PHP & Laravel
 
198970820 p-oooooooooo
198970820 p-oooooooooo198970820 p-oooooooooo
198970820 p-oooooooooo
 
Pulumi - IaC tool
Pulumi - IaC toolPulumi - IaC tool
Pulumi - IaC tool
 
Toad for-oracle-release-notes 142
Toad for-oracle-release-notes 142Toad for-oracle-release-notes 142
Toad for-oracle-release-notes 142
 
Drupal Overview For Techies
Drupal Overview For TechiesDrupal Overview For Techies
Drupal Overview For Techies
 
Philipe Riand - Building Social Applications using the Social Business Toolki...
Philipe Riand - Building Social Applications using the Social Business Toolki...Philipe Riand - Building Social Applications using the Social Business Toolki...
Philipe Riand - Building Social Applications using the Social Business Toolki...
 
A Quick Look at Drupal
A Quick Look at DrupalA Quick Look at Drupal
A Quick Look at Drupal
 
Osss cad
Osss cadOsss cad
Osss cad
 
Copmuter Languages
Copmuter LanguagesCopmuter Languages
Copmuter Languages
 
Synapse india fundamentals of dotnet development
Synapse india fundamentals of dotnet  developmentSynapse india fundamentals of dotnet  development
Synapse india fundamentals of dotnet development
 

Dernier

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 

Dernier (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 

A visual DSL toolkit in Lua: Past, present and future

  • 1. A visual DSL toolkit in Lua Past, present and future Alexander Gladysh <ag@logiceditor.com> Lua Workshop 2013 Toulouse 1 / 44
  • 2. Outline Introduction The Problem Classic third-party alternatives Past generations The present generation The future Questions? 2 / 44
  • 3. Alexander Gladysh CTO, co-founder at LogicEditor In löve with Lua since 2005 3 / 44
  • 4. LogicEditor Use Lua to develop: Visual DSL toolkit (subject of this talk) Big-data analytics Intensive-load web-services In-browser and mobile games 600+ KLOC of private Lua codebase Some contributions to open-source Lua projects 4 / 44
  • 5. The Problem Business-logic is highly volatile. Programmers are not domain area specialists. Specialist ⇔ Manager ⇔ Programmer loop is slow. Specialist ⇔ Programmer loop is expensive. Let specialists do the business-logic! 5 / 44
  • 7. Non-programmers aren’t programmers It is not enough to be able to compose an algorithm and even implement it with some simple programming language. For commercial programming you’ll also need, at least: Technical background Debugging skills Team coding skills 7 / 44
  • 8. Solution A tool that prevents technical mistakes While limiting creativity as little as possible And is within grasp of a non-programmer. 8 / 44
  • 9. Ad-hoc implementations One-shot, very limited flexibility Full of crutches Hard to maintain 9 / 44
  • 12. Descent Freespace Editor Events 12 / 44
  • 15. What is in common? A visual domain-specific language, that allows user to describe the control-flow. 15 / 44
  • 16. A retrospective of ideas Screenshots shown here are from editors done by me and/or my colleagues for different companies we worked for, over time. Only an idea was re-used and improved between generations. 16 / 44
  • 17. Video-adventure game editor (No screenshots available) Legacy, circa 2002—2004 Graph of in-game dialog remarks and answer choices Allowing to tie-in video-loop to remark No Lua. 17 / 44
  • 18. Adventure game dialog editor, I, II Graph of in-game dialog remarks and answer choices With ability to add custom Lua code logic (in II) Generated data (in Lua) for a state machine (also in Lua) 18 / 44
  • 19. Browser MMO quest editor, I, II 19 / 44
  • 20. Browser MMO magic system editor 20 / 44
  • 21. Analysis Some non-programmers prefer visual control-flow editors. Some — textual representation. (Programmers hate to use both kinds.) All editors were very useful, some — invaluable. But, in retrospective, some should have been replaced by dedicated coders. None of the past-generation editors were flexible enough to be used outside its immediate domain (but this never was an official goal for them). 21 / 44
  • 22. The Visual Business Logic Editor Toolkit 22 / 44
  • 23. Design goals Easy to create new editors. Easy to support existing editors. Easy to integrate with "any" other project on "any" technology. Easy enough to learn and use by end-users. 23 / 44
  • 24. Editor use-cases For example: A dialog editor for a game scenario writer. A magic system editor for a game-designer. A mission logic editor for a game level-designer. A DB query editor for a data analyst (Hadoop, anyone?). An advertising campaign targeting editor for a marketer. ...and so on. 24 / 44
  • 25. Technology The data is a tree corresponding to the control flow (or to anything tree-like, actually). The output is structured text (code or data). Editor code, UI and backend, is generated by Lua code in the Toolkit, from the data "schema". Editor UI is in JavaScript / HTML, backend is in Lua. 25 / 44
  • 26. The Data Schema Embedded Lua DSL (see my talk on Lua WS’11). http://bit.ly/lua-dsl-talk Describes how to: check data validity, generate default data, render data to editor UI, change data in editor UI, render the conforming data to the output code (or data). Two layers: human-friendly and machine-friendly 26 / 44
  • 27. Schema Example, I See also: http://bit.ly/le7-schema lang:root "lua.print-string" lang:value "lua.string.value" { data_type = "string"; default = "Hallo, world!"; render:js [[String Value]] { [[${1}]] }; render:lua { [[${1}]] }; } 27 / 44
  • 28. Schema Example, II lang:func "lua.print-string" { "lua.string.value"; render:js [[Print string]] { [[Print: ${1}]]; }; render:lua { [[print(${1})]]; }; } 28 / 44
  • 29. Default Data { id = "lua.print-string"; { id = "lua.string.value"; "Hallo, world!"; } } Renders to Lua as: print("Hallo, world!") 29 / 44
  • 30. UI for default data (simplified) <div id="lua.print-string"> Print: <span id="lua.string.value">Hallo, world!</span> </div> NB: That <span> turns to edit-box on click. 30 / 44
  • 31. Extending string type lang:type "lua.string" { init = "lua.string.value"; render:js [[String]] { menu = [[S]]; [[${1}]] }; render:lua { [[${1}]] }; } lang:func "lua.string.reverse" { type = "lua.string"; render:js [[Reverse string]] { [[Reverse: ${1}]] }; render:lua { [[(${1}):reverse()]] }; } 31 / 44
  • 32. Print with multiple arguments lang:list "lua.print" { "lua.string"; render:js [[Print]] { empty = [[Print newline]]; before = [[Print values: <ul><li>]]; glue = [[</li><li>]]; after = [[</li></ul>]]; }; render:lua { before = [[print(]]; glue = [[,]]; after = [[)]]; }; } 32 / 44
  • 35. Data-upgrade routines A set of hooks for data tree traversal. Transformations between two given data versions. In terms of node schema. Semi-automatic, template code is generated. 35 / 44
  • 36. What else? Scopes in the schema. External and internal data-sources. 36 / 44
  • 37. Several points of improvement Current generation does its job well, but we see several ways on how to make it better Several points to improve Better, modern HTML (at the cost of support of IE6). Lua in browser for a server-less integration option. Even more flexible and expressive Schema DSL. NB: We’ll probably go for a control-flow diagram UI first, not text-based one (current text-based is cool enough). 37 / 44
  • 38. Problems with the current DSL One language for three separate concepts: data tree structure, editor UI, final output. Data tree structure gets a bit synthetic and convoluted at times. Should be easier to add alternative editor UIs. 38 / 44
  • 39. Solution Three separate sets of languages: data tree format, render to output (per output format), render to editor (per editor kind). CSS-like rules instead of pre-defined set of node types 39 / 44
  • 40. Early examples http://bit.ly/le8-proto data:root "script" data:type "script" ("*", "action") data:type "action" "print-var" "var-name" to:text "script" :T [[ local _VARS = {} ${indent(concat(children))} ]] to:text "print-var" "var-name" :T [[print(_VARS[${quote:lua(node)}])]] to:ui "print-var" "var-name" :T [[Print: ${child(1)})]] 40 / 44
  • 41. An alternative approach to the Embedded DSLs in Lua foo:bar "baz" { "quo" } local proxy proxy proxy proxy = foo = proxy["bar"] = proxy(foo, "baz") = proxy({ "quo" }) 41 / 44
  • 42. The FSM foo:bar "baz" { "quo" } If proxy is as a FSM, indexes and calls — state transitions. INIT | index "bar" -> foo.bar foo.bar | call -> foo.bar.name foo.bar.name | call -> foo.bar.name.param FINAL <- foo.bar.name.param Early working prototype: http://bit.ly/le-dsl-fsm. 42 / 44
  • 43. Easier to code complex DSL constructs play:scene [[SCENE II]] .location [[Another room in the castle.]] :enter "HAMLET" :remark "HAMLET" [[ Safely stowed. ]] :remark { "ROSENCRANTZ", "GILDERSTERN" } .cue [[within]] [[ Hamlet! Lord Hamlet! ]] :remark "HAMLET" [[ What noise? who calls on Hamlet? O, here they come. ]] 43 / 44