Presented by: Elena C. Ciobanu Mihai V. Ciobanu Kuntal Ghosh
Goals of DSL Scope of tool support for the DSL DSL definition overview DSL creation technology selected Editor design and sample usage Foreseen impact of language evolution Potential for analysis and/or code generation Conclusions
A programming language with minimal features and functionality for a particular area of interest or domain. Our DSL ◦ Generate and create data charts (pie, bar etc.) ◦ Very easy to use ◦ No prior programming knowledge needed ◦ Easy to learn and remember
DSLs can be implemented either by ◦ Interpretation or code generation ◦ A specific parser to process it We have taken the first approach
Internal DSLs ◦ Active Record Query Interface in Ruby on Rails ◦ Example client = Client.find(10) External DSLs. ◦ CSS
Xtext ◦ Grammar definition using regular expressions Xtend ◦ Mapping from Xtext to Java Eclipse ◦ Running environment
KeywordsOptional chartNo typeNo dataNo sizeNo legendYes rowkeyYes columnkeyYes axislabelsYes colorYes
Regular Expressions ◦ “In computing, a regular expression provides a concise and flexible means to "match" (specify and recognize) strings of text, such as particular characters, words, or patterns of characters.” (Wikipedia) Syntax Examples ◦ * (zero to many): a* “” “aaa” “aaaaaa” “ab” ◦ ? (zero or one): b?“bb”“b”“ab” “” ◦ + (one to many): a+ “” “aaa” “aaaaaa” “ab”
Xtend ◦ Mapping from DSL grammar to Java code Mapping ◦ Template based ◦ Java code entered in template is not parsed ◦ Xtend code maps Xtext to Java
JFreeCharts ◦ Swing ◦ Awt Jcommon Advantages ◦ Extensible ◦ Pre-built libraries
Java code evolution ◦ Xtend template adjustments Grammar evolution ◦ Xtext file adjustments
Chart DSL easy to use extendable Eclipse IDE advantages Auto-completion