Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Design concerns for concrete syntax


Published on

Course "Domain-specific programming languages" ( Developed by Mikhail Barash.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Design concerns for concrete syntax

  1. 1. Design concerns for concrete syntax
  2. 2. Concrete syntax Quorum A. Stefik (University of Nevada), S. Siebert (Washington School of Medicine) integer a variable that holds whole values if doing something after verifying that something is true Boolean equals checking whether one thing is the same as another thing array a variable that references one or more values in a row class representing something in the computer that exists in the real world method a list of instructions that represents a tangible behavior general-purpose language public a part of a computer program that can be accessed by another program try attempting to run code that may not run correctly
  3. 3. Concrete syntax Quorum notion non-programmerprogrammer score score integer numberinteger number real integer real 8.38 6.20 5.88 6.63 6.46 5.91 float numberdecimal number float decimal rational 6.81 6.79 6.68 6.70 6.43 6.07
  4. 4. Concrete syntax Quorum Boolean conditionboolean bool binary logic binary 7.68 7.63 6.25 5.32 5.26 5.11 string charactersstring text charstring text charstring 7.48 7.23 7.21 6.37 6.15 5.89 notion non-programmerprogrammer score score
  5. 5. Concrete syntax Quorum assignment x = 1024x = 1024 x is 1024 x =: 1024 x is 1024 x : 1024 7.87 5.77 5.45 6.90 6.32 5.51 type cast use t as Doghandle t as Dog use t as Dog cast(t, Dog) handle t as Dog apply Dog to t 6.15 5.99 5.85 5.90 5.82 5.46 in Java: (Dog)t notion non-programmerprogrammer score score
  6. 6. Concrete syntax Quorum increment x = x + 1x = x + 1 x++ x += 1 x + 1 raise x 8.37 7.44 7.14 7.06 5.93 5.49 if statement ifif when whenever when require 8.37 7.49 6.86 6.89 6.59 6.46 notion non-programmerprogrammer score score
  7. 7. Concrete syntax Quorum notion non-programmerprogrammer class objectobject structure class structure framework parent sourcesource parent foundation foundation parentsuper this selfself me myself myself me abstract blueprintprototype frame blueprint frame model return providereturn report provide report return constant permanentconstant const permanent constant const try checktest check try test on error static constantfixed constant static permanent fixed
  8. 8. Viscosity of notations print ”text1” in bold print ”text2” in bold + italic print ”text3” in bold + red print ”text4” in bold introduce “styles” style MyStyle is bold using MyStyle { print “text1” print “text2” in italic print “text3” in red print “text4” } can be easily changed for all usages modify the style of several items at once no need to change the style of each individual item repetition viscosity repetition viscosity
  9. 9. Viscosity of notations knock-on viscosity repetition viscosity scope viscosity violates internal constrains in the programchange in code their resolution violates further constraints change in size of input data requires changes to program structure Turbo Pascal didn’t allow for dynamic arrays single action within model requires many repetitive actions
  10. 10. Writability and readability writable syntax users not necessarily readable tool support readable syntax can be written effectively can be read effectively concise have to type less editing support from IDE  writability of syntax code completion quickfixes a more concise syntax tables emphasize readability over writability
  11. 11. Writability and readability APL “A Programming Language” central datatype multidimensional array to represent most functions and operatorsspecial graphic symbols very concise code IBM 2741 special keyboard
  12. 12. Writability and readability MUMPS Massachusetts General Hospital Utility Multi- Programming System no reserved words abbreviations for concepts no priority of arithmetic operations keywords can be used as identifiers 2+3*10 50
  13. 13. Writability and readability Piet esoteric language program that prints “Hello, world!”
  14. 14. Learnability and effectiveness learnable syntax conceptsthe more effective syntax useful for novices can be “explored” by exploiting IDE support “press Ctrl+Space and the tool will tell you what you can type next” have direct meaning in the domain the easier to learn the language after learning the language users can express domain problems effectively
  15. 15. Multiple notations different syntaxes for the same abstract syntax let users choose more learnable and verbosebeginners more effective syntaxexperienced easy to define several notations projectional editors
  16. 16. IDE supportability SQL SELECT field1, field2 FROM table1 WHERE ... FROM table1 SELECT field1, field2 WHERE ... textual languages syntax can be supported by IDE code completion when typing this code, a user can’t get any support from IDE because table has not yet been specified a better syntax with respect to IDE support
  17. 17. IDE supportability functional languages advantage in terms of IDE support function call in either case, function comes first f(a,b,c) a.f(b,c) alternative notation first argument before the dot (optional syntax) (f a b c) after the user types “a.” suggest all functions available for the type of acode completion much better explorability of the language