SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
Scaling declarative language specifications
to full-featured languages
and real-world applications1
Ted Kaminksi and Eric Van Wyk
University of Minnesota
SLS 2013, June 25, 2013, Cambridge
1
This work is partially supported by NSF Awards No. 0905581 and
1047961.
c Eric Van Wyk 1
Scaling up: languages
c Eric Van Wyk 2
Scaling up: users
c Eric Van Wyk 3
Scaling up: languages
One strategy:
identify a “core” language
new features translate down to core features
For example:
for-loop to an initializing assignment and while-loop
int x,y,z, to int x; int y; int z;,
Difficult question: Which features are part of the core?
c Eric Van Wyk 4
Implicit and explicit specification of semantics
Specify semantics
explictly, where desirable/needed
implicitly, via translation, where possible
ArrayList herd = ... ;
for (Goat g: herd) {
g.milk ();
}
language feature-specific
error messages, analysis
optimizations
from Java 1.5 translates to code in Java 1.4:
ArrayList herd = ... ;
for (Iterator it = herd.iterator(); it.hasNext();) {
Goat g = (Goat) it.next(); g.milk();
}
for byte code generation
c Eric Van Wyk 5
Forwarding
supports explicit and implicit (via translation)
specification of semantics
originated in Intentional Programming at MSR Redmond,
adapted to attribute grammars at Oxford [CC’02]
In attribute grammar terminology:
production define some attributes
construct a semantically equivalent syntax tree and
“forward” queries for undefined attributes to that tree
Similar to prototype or object inheritance, not class
inheritance.
c Eric Van Wyk 6
abstract production enhanced for
f::Stmt ::= ’for’ ’(’ t::Type id::Id ’:’ data::Expr ’)’
body::Stmt
{ f.errors = if isCollection || isArray then [ ]
else [ "Enhanced-for must iterate over " ++
"Collections or arrays." ];
data.env = addEnv( id, t.typerep, f.env ) ;
local attribute isCollection :: Boolean =
match( data.typerep, collectionType( ) ) ;
local attribute isArray :: Boolean =
match( data.typerep, arrayTypeRep( ) ) ;
forwards to if isCollection then forOverCollection
else if isArray then forOverArray
else skip() ;
local attribute forOverCollection :: Stmt =
... syntax tree of for-loop over a collection...
local attribute forOverArray :: Stmt =
... syntax tree of for-loop over an array...
}c Eric Van Wyk 7
Various uses
Name binding
production unboundVarRef
e::Expr ::= v::VarRef t
forwards to
production boundVarRef
e::Expr ::= v::VarRef t dcl::Decorated Dcl
operator overloading
generic addition
forwards to
type-specific addition (e.g. integer, matrix, ... )
c Eric Van Wyk 8
Scaling up: users
c Eric Van Wyk 9
Extensible Languages (Frameworks)
@MSR: Intentional Programming
@Minnesota: ableJ [ECOOP’07], ableP [SPIN’11]
pluggable domain-specific language extensions
domain-specific syntax, analysis, and optimization
composable, developed independently!
general purpose host language still available
Extension features translate down to host language
c Eric Van Wyk 10
class Demo {
int demoMethod ( ) {
List<List<Integer>> dlist ;
int T ;
int SELECT ;
connection c "jdbc:derby:/home/derby/db/testdb"
with table person [ person id INTEGER,
first name VARCHAR,
last name VARCHAR ] ,
table details [ person id INTEGER,
age INTEGER ] ;
Integer limit = 18 ;
ResultSet rs = using c query {
SELECT age, gender, last name
FROM person , details
WHERE person.person id = details.person id
AND details.age > limit } ;
Integer = rs.getInteger("age");
String gender = rs.getString("gender");
boolean b ;
b = table ( age > 40 : T * ,
gender == "M" : T F ) ;
}
}
• natural syntax
• semantic analysis
• composable extensions
• SQL queries
• non-null pointer
analysis
• tabular boolean
expressions
c Eric Van Wyk 11
Extensibility: safe composability








Non-null
pointer
analysis
SQL
queries
c Eric Van Wyk 12
Extensibility: safe composability
SQL
queries
Non-null
pointer
analysis
c Eric Van Wyk 13
Roles people play ...
1. host language designer
2. language extension designer
3. programmer
language extension user
c Eric Van Wyk 14
c Eric Van Wyk 15
Extensible languages require declarative
specifications
Composable language/extension specifications.
For composable (no glue code) extensions, forwarding is
needed.
These make extensible language possible, but don’t
esnure that the extensions will, in fact, compose.
modular analysis are needed.
c Eric Van Wyk 16
Building a parser from composed specifications.
... CFGH
∪∗
{CFGE1
, ..., CFGEn
}
∀i ∈ [1, n].isComposable(CFGH
, CFGEi
)∧
conflictFree(CFGH
∪ CFGEi
)
⇒ ⇒ conflictFree(CFGH
∪ {CFGE1
, ..., CFGEn
})
Monolithic analysis - not too hard, but not too useful.
Modular analysis - harder, but required [PLDI’09].
Non-commutative composition of restricted LALR(1)
grammars.
c Eric Van Wyk 17
Building an attribute grammar evaluator from composed
specifications.
... AGH
∪∗
{AGE1
, ..., AGEn
}
∀i ∈ [1, n].modComplete(AGH
, AGEi
)
⇒ ⇒ complete(AGH
∪ {AGE
1 , ..., AGE
n })
Monolithic analysis - not too hard, but not too useful.
Modular analysis - harder, but required [SLE’12a].
c Eric Van Wyk 18
c Eric Van Wyk 19
Future work
#include <sdtio.h>
int main() {
... bits of SAC ...
... stencil specifications ...
... computational geometry optimizations
robustness transformations ...
}
c Eric Van Wyk 20
Thanks for your attention.
Questions?
http://melt.cs.umn.edu
evw@cs.umn.edu
c Eric Van Wyk 21
E. Van Wyk, O. de Moor, K. Backhouse, and
P. Kwiatkowski.
Forwarding in attribute grammars for modular language
design.
In 11th Conf. on Compiler Construction (CC), volume
2304 of LNCS, pages 128–142. Springer-Verlag, 2002.
Eric Van Wyk, Lijesh Krishnan, August Schwerdfeger, and
Derek Bodin.
Attribute grammar-based language extensions for Java.
In Proc. of European Conf. on Object Oriented Prog.
(ECOOP), volume 4609 of LNCS, pages 575–599.
Springer-Verlag, 2007.
c Eric Van Wyk 21
Yogesh Mali and Eric Van Wyk.
Building extensible specifications and implementations of
promela with AbleP.
In Proc. of Intl. SPIN Workshop on Model Checking of
Software, volume 6823 of LNCS, pages 108–125.
Springer-Verlag, July 2011.
August Schwerdfeger and Eric Van Wyk.
Verifiable composition of deterministic grammars.
In Proc. of Conf. on Programming Language Design and
Implementation (PLDI), pages 199–210. ACM, June 2009.
Ted Kaminski and Eric Van Wyk.
Modular well-definedness analysis for attribute grammars.
In Proc. of Intl. Conf. on Software Language Engineering
(SLE), volume 7745 of LNCS, pages 352–371.
Springer-Verlag, September 2012.
c Eric Van Wyk 21
Lijesh Krishnan and Eric Van Wyk.
Termination analysis for higher-order attribute grammars.
In Proceedings of the 5th International Conference on
Software Language Engineering (SLE 2012), volume 7745
of LNCS, pages 44–63. Springer-Verlag, September 2012.
Lijesh Krishnan.
Composable Semantics Using Higher-Order Attribute
Grammars.
PhD thesis, University of Minnesota, Department of
Computer Science and Engineering, Minneapolis,
Minnesota, USA, 2012.
Available at
http://melt.cs.umn.edu/pubs/krishnan2012PhD/.
c Eric Van Wyk 21

Más contenido relacionado

La actualidad más candente

Programming languages vienna
Programming languages viennaProgramming languages vienna
Programming languages vienna
greg_s
 
Programming Language
Programming  LanguageProgramming  Language
Programming Language
Adeel Hamid
 
Brief introduction to the c programming language
Brief introduction to the c programming languageBrief introduction to the c programming language
Brief introduction to the c programming language
Kumar Gaurav
 
Formalizing homogeneous language embeddings
Formalizing homogeneous language embeddingsFormalizing homogeneous language embeddings
Formalizing homogeneous language embeddings
ClarkTony
 

La actualidad más candente (20)

Programming languages vienna
Programming languages viennaProgramming languages vienna
Programming languages vienna
 
Introduction to c programming language
Introduction to c programming languageIntroduction to c programming language
Introduction to c programming language
 
C language introduction
C language introduction C language introduction
C language introduction
 
Cling the llvm based interpreter
Cling the llvm based interpreterCling the llvm based interpreter
Cling the llvm based interpreter
 
C som-programmeringssprog-bt
C som-programmeringssprog-btC som-programmeringssprog-bt
C som-programmeringssprog-bt
 
C/C++ History in few slides
C/C++ History in few slides C/C++ History in few slides
C/C++ History in few slides
 
C++ history session 00 history
C++ history session 00   historyC++ history session 00   history
C++ history session 00 history
 
Migrating from Objective-C to Swift
Migrating from Objective-C to SwiftMigrating from Objective-C to Swift
Migrating from Objective-C to Swift
 
C++ language
C++ languageC++ language
C++ language
 
Difference between c, c++ and java
Difference between c, c++ and javaDifference between c, c++ and java
Difference between c, c++ and java
 
History of c++
History of c++History of c++
History of c++
 
Understanding jvm
Understanding jvmUnderstanding jvm
Understanding jvm
 
presentation on C++ basics by prince kumar kushwaha
presentation on C++ basics by prince kumar kushwahapresentation on C++ basics by prince kumar kushwaha
presentation on C++ basics by prince kumar kushwaha
 
Programming Language
Programming  LanguageProgramming  Language
Programming Language
 
introduction to c programming language
introduction to c programming languageintroduction to c programming language
introduction to c programming language
 
difference between c c++ c#
difference between c c++ c#difference between c c++ c#
difference between c c++ c#
 
XtremeDistil: Multi-stage Distillation for Massive Multilingual Models
XtremeDistil: Multi-stage Distillation for Massive Multilingual ModelsXtremeDistil: Multi-stage Distillation for Massive Multilingual Models
XtremeDistil: Multi-stage Distillation for Massive Multilingual Models
 
Brief introduction to the c programming language
Brief introduction to the c programming languageBrief introduction to the c programming language
Brief introduction to the c programming language
 
C vs c++
C vs c++C vs c++
C vs c++
 
Formalizing homogeneous language embeddings
Formalizing homogeneous language embeddingsFormalizing homogeneous language embeddings
Formalizing homogeneous language embeddings
 

Destacado

Miller Children’s to Hold iWalk…4 Kids Event in October
Miller Children’s to Hold iWalk…4 Kids Event in OctoberMiller Children’s to Hold iWalk…4 Kids Event in October
Miller Children’s to Hold iWalk…4 Kids Event in October
Gary Fournier
 
Biodiverse - Rosauer talk @ iEvoBio conference June 2010
Biodiverse - Rosauer talk @ iEvoBio conference June 2010Biodiverse - Rosauer talk @ iEvoBio conference June 2010
Biodiverse - Rosauer talk @ iEvoBio conference June 2010
Dan Rosauer
 
2007990026 류현규
2007990026 류현규2007990026 류현규
2007990026 류현규
eunae jp
 
Edge Talk: 'Out of our boxes. Patients as agents of change' by Alison Cameron...
Edge Talk: 'Out of our boxes. Patients as agents of change' by Alison Cameron...Edge Talk: 'Out of our boxes. Patients as agents of change' by Alison Cameron...
Edge Talk: 'Out of our boxes. Patients as agents of change' by Alison Cameron...
NHS Improving Quality
 
교환학생 - 박상민
교환학생 - 박상민교환학생 - 박상민
교환학생 - 박상민
종호 이
 
임베디드 시스템 찾기 + 모듈
임베디드 시스템 찾기 + 모듈임베디드 시스템 찾기 + 모듈
임베디드 시스템 찾기 + 모듈
shinminkyung
 
Hazard assessment for a pharmaceutical mixture detected in the upper Tennesse...
Hazard assessment for a pharmaceutical mixture detected in the upper Tennesse...Hazard assessment for a pharmaceutical mixture detected in the upper Tennesse...
Hazard assessment for a pharmaceutical mixture detected in the upper Tennesse...
GJESM Publication
 
Ldml application - public
Ldml   application - publicLdml   application - public
Ldml application - public
seanscon
 
10 Non-Muslim author's who wrote a book on MUHAMMAD P.C.B.H
10 Non-Muslim author's who wrote a book on MUHAMMAD P.C.B.H 10 Non-Muslim author's who wrote a book on MUHAMMAD P.C.B.H
10 Non-Muslim author's who wrote a book on MUHAMMAD P.C.B.H
FURQAN M LODHI
 

Destacado (20)

Future mathematicians.edu653
Future mathematicians.edu653Future mathematicians.edu653
Future mathematicians.edu653
 
Miller Children’s to Hold iWalk…4 Kids Event in October
Miller Children’s to Hold iWalk…4 Kids Event in OctoberMiller Children’s to Hold iWalk…4 Kids Event in October
Miller Children’s to Hold iWalk…4 Kids Event in October
 
Biodiverse - Rosauer talk @ iEvoBio conference June 2010
Biodiverse - Rosauer talk @ iEvoBio conference June 2010Biodiverse - Rosauer talk @ iEvoBio conference June 2010
Biodiverse - Rosauer talk @ iEvoBio conference June 2010
 
2007990026 류현규
2007990026 류현규2007990026 류현규
2007990026 류현규
 
Edge Talk: 'Out of our boxes. Patients as agents of change' by Alison Cameron...
Edge Talk: 'Out of our boxes. Patients as agents of change' by Alison Cameron...Edge Talk: 'Out of our boxes. Patients as agents of change' by Alison Cameron...
Edge Talk: 'Out of our boxes. Patients as agents of change' by Alison Cameron...
 
교환학생 - 박상민
교환학생 - 박상민교환학생 - 박상민
교환학생 - 박상민
 
공동체활성화를 위한 도시농업네트워크
공동체활성화를 위한 도시농업네트워크공동체활성화를 위한 도시농업네트워크
공동체활성화를 위한 도시농업네트워크
 
페이스북 기업 페이지 이용형태 조사보고서
페이스북 기업 페이지 이용형태 조사보고서페이스북 기업 페이지 이용형태 조사보고서
페이스북 기업 페이지 이용형태 조사보고서
 
임베디드 시스템 찾기 + 모듈
임베디드 시스템 찾기 + 모듈임베디드 시스템 찾기 + 모듈
임베디드 시스템 찾기 + 모듈
 
Power BI
Power BIPower BI
Power BI
 
Hazard assessment for a pharmaceutical mixture detected in the upper Tennesse...
Hazard assessment for a pharmaceutical mixture detected in the upper Tennesse...Hazard assessment for a pharmaceutical mixture detected in the upper Tennesse...
Hazard assessment for a pharmaceutical mixture detected in the upper Tennesse...
 
Session 2a - Quisumbing and Malapit - Using the WEAI for analysis in differen...
Session 2a - Quisumbing and Malapit - Using the WEAI for analysis in differen...Session 2a - Quisumbing and Malapit - Using the WEAI for analysis in differen...
Session 2a - Quisumbing and Malapit - Using the WEAI for analysis in differen...
 
Activeand passivevoicepp
Activeand passivevoiceppActiveand passivevoicepp
Activeand passivevoicepp
 
Acosta dante England? Britain? What?
Acosta dante England? Britain? What?Acosta dante England? Britain? What?
Acosta dante England? Britain? What?
 
LM 2
LM 2LM 2
LM 2
 
Open Data Journalism
Open Data JournalismOpen Data Journalism
Open Data Journalism
 
Spagic3 Presentation En
Spagic3 Presentation EnSpagic3 Presentation En
Spagic3 Presentation En
 
Balancing Sticky Content with SEO
Balancing Sticky Content with SEOBalancing Sticky Content with SEO
Balancing Sticky Content with SEO
 
Ldml application - public
Ldml   application - publicLdml   application - public
Ldml application - public
 
10 Non-Muslim author's who wrote a book on MUHAMMAD P.C.B.H
10 Non-Muslim author's who wrote a book on MUHAMMAD P.C.B.H 10 Non-Muslim author's who wrote a book on MUHAMMAD P.C.B.H
10 Non-Muslim author's who wrote a book on MUHAMMAD P.C.B.H
 

Similar a Scaling Language Specifications

TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific Languages
Eelco Visser
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
Satish Verma
 
Challenges In Dsl Design
Challenges In Dsl DesignChallenges In Dsl Design
Challenges In Dsl Design
Sven Efftinge
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
jeffz
 

Similar a Scaling Language Specifications (20)

Global DSL workshop slides
Global DSL workshop slidesGlobal DSL workshop slides
Global DSL workshop slides
 
Talk Lund University CS Department
Talk Lund University CS DepartmentTalk Lund University CS Department
Talk Lund University CS Department
 
Domain specific languages and Scala
Domain specific languages and ScalaDomain specific languages and Scala
Domain specific languages and Scala
 
Compiler Construction | Lecture 1 | What is a compiler?
Compiler Construction | Lecture 1 | What is a compiler?Compiler Construction | Lecture 1 | What is a compiler?
Compiler Construction | Lecture 1 | What is a compiler?
 
TI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific LanguagesTI1220 Lecture 14: Domain-Specific Languages
TI1220 Lecture 14: Domain-Specific Languages
 
Enhancing Domain Specific Language Implementations Through Ontology
Enhancing Domain Specific Language Implementations Through OntologyEnhancing Domain Specific Language Implementations Through Ontology
Enhancing Domain Specific Language Implementations Through Ontology
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
Challenges In Dsl Design
Challenges In Dsl DesignChallenges In Dsl Design
Challenges In Dsl Design
 
Slides:Coercion Quantification
Slides:Coercion QuantificationSlides:Coercion Quantification
Slides:Coercion Quantification
 
Scam 08
Scam 08Scam 08
Scam 08
 
Programming Languages: some news for the last N years
Programming Languages: some news for the last N yearsProgramming Languages: some news for the last N years
Programming Languages: some news for the last N years
 
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)The Evolution of Async-Programming on .NET Platform (.Net China, C#)
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
 
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
ECMAScript 6: A Better JavaScript for the Ambient Computing EraECMAScript 6: A Better JavaScript for the Ambient Computing Era
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
 
E sampark with c#.net
E sampark with c#.netE sampark with c#.net
E sampark with c#.net
 
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
 
PL Lecture 01 - preliminaries
PL Lecture 01 - preliminariesPL Lecture 01 - preliminaries
PL Lecture 01 - preliminaries
 
Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)
 
Concepts of JetBrains MPS
Concepts of JetBrains MPSConcepts of JetBrains MPS
Concepts of JetBrains MPS
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
CS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: IntroductionCS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: Introduction
 

Último

Último (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 

Scaling Language Specifications

  • 1. Scaling declarative language specifications to full-featured languages and real-world applications1 Ted Kaminksi and Eric Van Wyk University of Minnesota SLS 2013, June 25, 2013, Cambridge 1 This work is partially supported by NSF Awards No. 0905581 and 1047961. c Eric Van Wyk 1
  • 2. Scaling up: languages c Eric Van Wyk 2
  • 3. Scaling up: users c Eric Van Wyk 3
  • 4. Scaling up: languages One strategy: identify a “core” language new features translate down to core features For example: for-loop to an initializing assignment and while-loop int x,y,z, to int x; int y; int z;, Difficult question: Which features are part of the core? c Eric Van Wyk 4
  • 5. Implicit and explicit specification of semantics Specify semantics explictly, where desirable/needed implicitly, via translation, where possible ArrayList herd = ... ; for (Goat g: herd) { g.milk (); } language feature-specific error messages, analysis optimizations from Java 1.5 translates to code in Java 1.4: ArrayList herd = ... ; for (Iterator it = herd.iterator(); it.hasNext();) { Goat g = (Goat) it.next(); g.milk(); } for byte code generation c Eric Van Wyk 5
  • 6. Forwarding supports explicit and implicit (via translation) specification of semantics originated in Intentional Programming at MSR Redmond, adapted to attribute grammars at Oxford [CC’02] In attribute grammar terminology: production define some attributes construct a semantically equivalent syntax tree and “forward” queries for undefined attributes to that tree Similar to prototype or object inheritance, not class inheritance. c Eric Van Wyk 6
  • 7. abstract production enhanced for f::Stmt ::= ’for’ ’(’ t::Type id::Id ’:’ data::Expr ’)’ body::Stmt { f.errors = if isCollection || isArray then [ ] else [ "Enhanced-for must iterate over " ++ "Collections or arrays." ]; data.env = addEnv( id, t.typerep, f.env ) ; local attribute isCollection :: Boolean = match( data.typerep, collectionType( ) ) ; local attribute isArray :: Boolean = match( data.typerep, arrayTypeRep( ) ) ; forwards to if isCollection then forOverCollection else if isArray then forOverArray else skip() ; local attribute forOverCollection :: Stmt = ... syntax tree of for-loop over a collection... local attribute forOverArray :: Stmt = ... syntax tree of for-loop over an array... }c Eric Van Wyk 7
  • 8. Various uses Name binding production unboundVarRef e::Expr ::= v::VarRef t forwards to production boundVarRef e::Expr ::= v::VarRef t dcl::Decorated Dcl operator overloading generic addition forwards to type-specific addition (e.g. integer, matrix, ... ) c Eric Van Wyk 8
  • 9. Scaling up: users c Eric Van Wyk 9
  • 10. Extensible Languages (Frameworks) @MSR: Intentional Programming @Minnesota: ableJ [ECOOP’07], ableP [SPIN’11] pluggable domain-specific language extensions domain-specific syntax, analysis, and optimization composable, developed independently! general purpose host language still available Extension features translate down to host language c Eric Van Wyk 10
  • 11. class Demo { int demoMethod ( ) { List<List<Integer>> dlist ; int T ; int SELECT ; connection c "jdbc:derby:/home/derby/db/testdb" with table person [ person id INTEGER, first name VARCHAR, last name VARCHAR ] , table details [ person id INTEGER, age INTEGER ] ; Integer limit = 18 ; ResultSet rs = using c query { SELECT age, gender, last name FROM person , details WHERE person.person id = details.person id AND details.age > limit } ; Integer = rs.getInteger("age"); String gender = rs.getString("gender"); boolean b ; b = table ( age > 40 : T * , gender == "M" : T F ) ; } } • natural syntax • semantic analysis • composable extensions • SQL queries • non-null pointer analysis • tabular boolean expressions c Eric Van Wyk 11
  • 14. Roles people play ... 1. host language designer 2. language extension designer 3. programmer language extension user c Eric Van Wyk 14
  • 15. c Eric Van Wyk 15
  • 16. Extensible languages require declarative specifications Composable language/extension specifications. For composable (no glue code) extensions, forwarding is needed. These make extensible language possible, but don’t esnure that the extensions will, in fact, compose. modular analysis are needed. c Eric Van Wyk 16
  • 17. Building a parser from composed specifications. ... CFGH ∪∗ {CFGE1 , ..., CFGEn } ∀i ∈ [1, n].isComposable(CFGH , CFGEi )∧ conflictFree(CFGH ∪ CFGEi ) ⇒ ⇒ conflictFree(CFGH ∪ {CFGE1 , ..., CFGEn }) Monolithic analysis - not too hard, but not too useful. Modular analysis - harder, but required [PLDI’09]. Non-commutative composition of restricted LALR(1) grammars. c Eric Van Wyk 17
  • 18. Building an attribute grammar evaluator from composed specifications. ... AGH ∪∗ {AGE1 , ..., AGEn } ∀i ∈ [1, n].modComplete(AGH , AGEi ) ⇒ ⇒ complete(AGH ∪ {AGE 1 , ..., AGE n }) Monolithic analysis - not too hard, but not too useful. Modular analysis - harder, but required [SLE’12a]. c Eric Van Wyk 18
  • 19. c Eric Van Wyk 19
  • 20. Future work #include <sdtio.h> int main() { ... bits of SAC ... ... stencil specifications ... ... computational geometry optimizations robustness transformations ... } c Eric Van Wyk 20
  • 21. Thanks for your attention. Questions? http://melt.cs.umn.edu evw@cs.umn.edu c Eric Van Wyk 21
  • 22. E. Van Wyk, O. de Moor, K. Backhouse, and P. Kwiatkowski. Forwarding in attribute grammars for modular language design. In 11th Conf. on Compiler Construction (CC), volume 2304 of LNCS, pages 128–142. Springer-Verlag, 2002. Eric Van Wyk, Lijesh Krishnan, August Schwerdfeger, and Derek Bodin. Attribute grammar-based language extensions for Java. In Proc. of European Conf. on Object Oriented Prog. (ECOOP), volume 4609 of LNCS, pages 575–599. Springer-Verlag, 2007. c Eric Van Wyk 21
  • 23. Yogesh Mali and Eric Van Wyk. Building extensible specifications and implementations of promela with AbleP. In Proc. of Intl. SPIN Workshop on Model Checking of Software, volume 6823 of LNCS, pages 108–125. Springer-Verlag, July 2011. August Schwerdfeger and Eric Van Wyk. Verifiable composition of deterministic grammars. In Proc. of Conf. on Programming Language Design and Implementation (PLDI), pages 199–210. ACM, June 2009. Ted Kaminski and Eric Van Wyk. Modular well-definedness analysis for attribute grammars. In Proc. of Intl. Conf. on Software Language Engineering (SLE), volume 7745 of LNCS, pages 352–371. Springer-Verlag, September 2012. c Eric Van Wyk 21
  • 24. Lijesh Krishnan and Eric Van Wyk. Termination analysis for higher-order attribute grammars. In Proceedings of the 5th International Conference on Software Language Engineering (SLE 2012), volume 7745 of LNCS, pages 44–63. Springer-Verlag, September 2012. Lijesh Krishnan. Composable Semantics Using Higher-Order Attribute Grammars. PhD thesis, University of Minnesota, Department of Computer Science and Engineering, Minneapolis, Minnesota, USA, 2012. Available at http://melt.cs.umn.edu/pubs/krishnan2012PhD/. c Eric Van Wyk 21