SlideShare a Scribd company logo
Projectional editing
Projectional editing
source-based
editing system
projectional
editing system
program defined using a textual representation
can be read and edited with any text-editing tool
source code key representation of programtext
representation of underlying model
read and edited using special environment
semantic model key representation of program
can be projected into different representations
program
text diagrams tables forms
Equation Editor
semantic model
syntactic
projection
placeholder
“smooth” editing
MVC pattern
model
projection edited projection
projection
model
editor transforms text “sin” to projection of sine
“^” is transformed to projection of exponentiation
placeholder
Microsoft Word
Scratch
placeholder
editing moving blocks
filling placeholders
placeholder
programs always have correct structure
impossible to have wrong structure
semantic analysis context conditions
e.g., type matching
have to be implemented
code generation transform model to code
Projectional editing
projectional editing user edits AST representation of code directly
“MVC applied to code”
editor mimics behavior of a text editor to some extent
user sees text
user edits text it’s an illusion
projection of AST
abstract syntax tree – logical representation of code
user sees table user edits table
user sees graphics user edits graphics
Projectional editing
top-down editing select a placeholder
bottom-up editing
select desired concept from a menu
similar to top-down editing
type something that would identify some concept
Content Assist in Eclipse
start with a space that is already occupied
select something to augment it
Word doesn’t have drop-down
menus for concepts
either by typing
or by selecting
from menu
special actions
copy-paste copy entire subtrees
Syntax trees and semantic analysis
int square(int x) {
return x * x;
}
original AST separate leaf node for every x
occurrences refer to the same variable
after parsing
requires semantic analysis
does not require parsingprojectional editing
AST is “finalized” by construction
a variable can be renamed and
new name is propagated to all nodes of AST
tt
should be the
same node
abstract syntax tree
Parsing and language evolution
parsing
C introduced new keywords class and template
complicates design of languages
int template = 1;
int class = template + 5;
valid C code invalid C++ code
can’t add new keywords without breaking existing codenew version of
a language
JavaScript allows keywords to be
used as field names of an object
each new syntactic construct must be evaluated before being added
Parsing vs. projectional editing
int class = template + 5; template= + ;classint 5
<expression>= ;<name>int
<variable declaration>
= ;<name>int
<variable declaration>
<expression>
<left> + <right>
textual
projectional
concept
trigger for concept fixed parts – in grey placeholders – in yellow
trigger
editor always has access to AST
current concept
containing concept
<name>int
name: string
any string can be used here
that string will be associated
with that variable name
concepts can also be
chosen from a menu user’s intention
Benefits of projectional editing
textual form of code only meant for the programmer
no need for curly braces, semicolons to separate constructs
projectional editing allows languages to evolve
but it is unambiguous
languages can be combined with each other
set of node types that can be added to ASTnew DSL
nodes are selected explicitly no ambiguities in AST
users of DSL communicate their exact intentions to the editor
textual syntax can look ambiguous

More Related Content

PDF
JetBrains MPS: Structure Aspect
PDF
Design dimensions of DSLs
PDF
Design concerns for concrete syntax
PDF
External domain-specific languages
PDF
Xtext: writing a grammar
PDF
Xtext: code generation
PDF
Xtext: Eclipse Modeling Framework
PPTX
Code quality
JetBrains MPS: Structure Aspect
Design dimensions of DSLs
Design concerns for concrete syntax
External domain-specific languages
Xtext: writing a grammar
Xtext: code generation
Xtext: Eclipse Modeling Framework
Code quality

What's hot (20)

PDF
Internal domain-specific languages
PPTX
C# lecture 2: Literals , Variables and Data Types in C#
DOCX
Mit4021 c# and .net
PPTX
code analysis for c++
PPT
Jdt Features
PPT
Literals,variables,datatype in C#
PPT
Adapter pattern
PPT
Overview of c#
PPT
Programming In C++
PPTX
Code Generation using T4
PPTX
Keyword Presentation
PPTX
Java tokens
PPTX
Compilers in computer programming
PDF
C#.net interview questions for dynamics 365 ce crm developers
RTF
over all view programming to computer
PPTX
Procedural programming
PPTX
Coding conventions
PPTX
Coding standards and guidelines
DOCX
Training 8051Report
PPTX
Adapter design-pattern2015
Internal domain-specific languages
C# lecture 2: Literals , Variables and Data Types in C#
Mit4021 c# and .net
code analysis for c++
Jdt Features
Literals,variables,datatype in C#
Adapter pattern
Overview of c#
Programming In C++
Code Generation using T4
Keyword Presentation
Java tokens
Compilers in computer programming
C#.net interview questions for dynamics 365 ce crm developers
over all view programming to computer
Procedural programming
Coding conventions
Coding standards and guidelines
Training 8051Report
Adapter design-pattern2015
Ad

Similar to Projectional editing (8)

PDF
Reflections on teaching JetBrains MPS within a university course
PPTX
Towards Structural Version Control
PDF
Your code is not a string
PDF
COSC3054 Lec 05 - Semantic Analysis and Type checking B.pdf
PPT
Ch5b.ppt
ODP
Code Analysis and Refactoring with CDT
ODP
[EclipseCon France 2017] Eclipse Platform Generic Editor
PPT
chapter7.ppt java programming lecture notes
Reflections on teaching JetBrains MPS within a university course
Towards Structural Version Control
Your code is not a string
COSC3054 Lec 05 - Semantic Analysis and Type checking B.pdf
Ch5b.ppt
Code Analysis and Refactoring with CDT
[EclipseCon France 2017] Eclipse Platform Generic Editor
chapter7.ppt java programming lecture notes
Ad

More from Mikhail Barash (19)

PDF
MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen
PDF
MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...
PDF
MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...
PDF
MODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept Entity
PDF
Towards a mnemonic classification of software languages
PDF
Worst practices for domain-specific modelling
PPTX
An ABC of JetBrains MPS
PDF
KernelF: a functional core for domain-specific languages in JetBrains MPS
PDF
Language Workbench Language Wheel
PDF
DSL development
PDF
JetBrains MPS: Typesystem Aspect
PDF
JetBrains MPS: Editor Aspect
PDF
Xtext: type checking and scoping
PDF
Xtext: validation, quickfixes, custom formatting
PDF
Xtend Programming Language
PDF
Language Workbenches
PDF
Implementing DSLs in practice
PDF
DSLs: what, why, how
PDF
Zoo of domain-specific languages
MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen
MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...
MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...
MODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept Entity
Towards a mnemonic classification of software languages
Worst practices for domain-specific modelling
An ABC of JetBrains MPS
KernelF: a functional core for domain-specific languages in JetBrains MPS
Language Workbench Language Wheel
DSL development
JetBrains MPS: Typesystem Aspect
JetBrains MPS: Editor Aspect
Xtext: type checking and scoping
Xtext: validation, quickfixes, custom formatting
Xtend Programming Language
Language Workbenches
Implementing DSLs in practice
DSLs: what, why, how
Zoo of domain-specific languages

Recently uploaded (20)

PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Introduction to Artificial Intelligence
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
ai tools demonstartion for schools and inter college
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
CHAPTER 2 - PM Management and IT Context
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Design an Analysis of Algorithms II-SECS-1021-03
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Reimagine Home Health with the Power of Agentic AI​
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
wealthsignaloriginal-com-DS-text-... (1).pdf
Introduction to Artificial Intelligence
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Which alternative to Crystal Reports is best for small or large businesses.pdf
ai tools demonstartion for schools and inter college
How to Choose the Right IT Partner for Your Business in Malaysia
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Wondershare Filmora 15 Crack With Activation Key [2025
Designing Intelligence for the Shop Floor.pdf
Odoo Companies in India – Driving Business Transformation.pdf
Digital Strategies for Manufacturing Companies
Design an Analysis of Algorithms I-SECS-1021-03
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf

Projectional editing

  • 2. Projectional editing source-based editing system projectional editing system program defined using a textual representation can be read and edited with any text-editing tool source code key representation of programtext representation of underlying model read and edited using special environment semantic model key representation of program can be projected into different representations program text diagrams tables forms
  • 3. Equation Editor semantic model syntactic projection placeholder “smooth” editing MVC pattern model projection edited projection projection model editor transforms text “sin” to projection of sine “^” is transformed to projection of exponentiation placeholder Microsoft Word
  • 4. Scratch placeholder editing moving blocks filling placeholders placeholder programs always have correct structure impossible to have wrong structure semantic analysis context conditions e.g., type matching have to be implemented code generation transform model to code
  • 5. Projectional editing projectional editing user edits AST representation of code directly “MVC applied to code” editor mimics behavior of a text editor to some extent user sees text user edits text it’s an illusion projection of AST abstract syntax tree – logical representation of code user sees table user edits table user sees graphics user edits graphics
  • 6. Projectional editing top-down editing select a placeholder bottom-up editing select desired concept from a menu similar to top-down editing type something that would identify some concept Content Assist in Eclipse start with a space that is already occupied select something to augment it Word doesn’t have drop-down menus for concepts either by typing or by selecting from menu special actions copy-paste copy entire subtrees
  • 7. Syntax trees and semantic analysis int square(int x) { return x * x; } original AST separate leaf node for every x occurrences refer to the same variable after parsing requires semantic analysis does not require parsingprojectional editing AST is “finalized” by construction a variable can be renamed and new name is propagated to all nodes of AST tt should be the same node abstract syntax tree
  • 8. Parsing and language evolution parsing C introduced new keywords class and template complicates design of languages int template = 1; int class = template + 5; valid C code invalid C++ code can’t add new keywords without breaking existing codenew version of a language JavaScript allows keywords to be used as field names of an object each new syntactic construct must be evaluated before being added
  • 9. Parsing vs. projectional editing int class = template + 5; template= + ;classint 5 <expression>= ;<name>int <variable declaration> = ;<name>int <variable declaration> <expression> <left> + <right> textual projectional concept trigger for concept fixed parts – in grey placeholders – in yellow trigger editor always has access to AST current concept containing concept <name>int name: string any string can be used here that string will be associated with that variable name concepts can also be chosen from a menu user’s intention
  • 10. Benefits of projectional editing textual form of code only meant for the programmer no need for curly braces, semicolons to separate constructs projectional editing allows languages to evolve but it is unambiguous languages can be combined with each other set of node types that can be added to ASTnew DSL nodes are selected explicitly no ambiguities in AST users of DSL communicate their exact intentions to the editor textual syntax can look ambiguous