Domain-specific language

Source: Internet
Author: User
Original Title: domain-specific ages original Publishing House: Addison-Wesley professional; 1 edition Author: (English) Martin Fowler Translator: thoughtworks China Book Series Name: china CHAPTER programmer library Publishing House: Machinery Industry Publishing House ISBN: 9787111413059 mounting Date: March 2013 publication date: 16 open pages: 464 versions: 1-1 category: computer> Software and programming> integration> advanced programming language design
For more information, see Introduction to "specific language in the field" computer books, and specific language in the field of DSL, he has been written by Martin Fowler, a world-class software development master and godfather of software development for many years. He is a Chinese translator of thoughtworks. A comprehensive and detailed explanation of various DSL and their construction methods reveals general principles and patterns unrelated to programming languages, this article explains how to effectively improve developers' productivity and enhance effective communication with experts in the field through DSL, which can provide effective decision-making basis and guiding methods for developers to select and use DSL. The book consists of 57 chapters, which are divided into six parts: The first part introduces what is DSL, the purpose of DSL, how to implement external DS and internal DSL, how to generate code, how to use the language workbench; the second part introduces various DSL and describes the working principles and application scenarios of Semantic Models, symbol tables, context variables, constructor, macros, and notifications; the third part reveals the delimiter-guided translation, syntax-guided translation, BNF, lexical analyzer for easy Regular Expression tables, lexical analyzer for Recursive descent, Parser combination, Parser Generator, tree construction, embedded syntax translation, embedded interpreter, and additional code; the fourth part introduces the expression generator, function sequence, nested function, method cascade, object range, closure, nested closure, annotation, number of parsed operations, Class symbol table, text color, literal volume working Principle and application scenarios of scaling; part 5 describes the working principles and application scenarios of adaptive models, decision tables, dependent networks, generative rule systems, and state machines; the sixth part introduces the converter-based code generation, templated generator, embedded assistant, model-based code generation, code generation and generation gap without model. Contents domain-specific language part 1 Introduction Chapter 1 introductory example 2 1st Gothic building security system 2 1.1 State Machine Model 4 1.2 programming for Miss Grant's controller 7 1.3 language and semantic model 13 1.5 Use code generation 15 1.6 use language workbench 17 1.7 visualization 20 Chapter 2nd use dsl21 2.1 define dsl21 2.1.1dsl boundary 22 2.1.2 segment DSL and independent dsl25 2.2 why need dsl25 2.2.1 improve development efficiency 26 2.2.2 communication with experts in the field 26 2.2.3 change in the execution environment 27. 2.2.4 other computing models 28 2.3dsl problems 28 2.3.1 language noise 29 2.3.2 construction costs 29 2.3.3 concentration camp language 30 2.3.4 abstract of "One Eye" 30 2.4 generalized language processing 31 2.5dsl lifecycle 31 2.6 where is the well-designed DSL coming from Chapter 32 3rd Implementing the architecture of dsl34 3.1dsl processing 34 3.2 How the parser works 37 3.3 grammar, syntax and semantics 39 3.4 parsing data 39 3.5 macros 41 3.6 Testing dsl42 3.6.1 semantic model test 42 3.6.2 parser Test 45 3.6.3 Script test 49 3.7 error handling 50 3.8dsl migration 51 Chapter 1 Internal dsl54 4th coherent API and command-query api54 4.1 resolution layer requirement 57 4.3 Use Function 58 4.4 literal set 61 4.5 grammar-based selection internal element 63 4.6 closure 64 4.7 resolution tree operation 66 4.8 annotation 67 4.9 provide extension 69 4.10 for literal volume Elimination syntax noise 69 4.11 dynamic reception 69 4.12 type check 70 chapter 5th external dsl72 5.1 syntax analysis policy 72 5.2 output generation policy 74 5.3 concepts in parsing 76 5.3.1 separate lexical analysis 76 5.3.2 syntax and language 77 5.3.3 regular syntax, context-independent grammar and context-related grammar 77 5.3.4 top-down and bottom-up parsing 79 5.4 mixed into another language 81 5.5xml dsl82 chapter 6th internal DSL external dsl84 6.1 learning curve 84 6.2 creation cost 85 6.3 programmer familiarity 85 6.4 communicate with field experts 86 6.5 mix with host language 86 6.6 strong boundary 87 6.7 runtime configuration 87 6.8 tend to mediocre 88 6.9 combination of multiple dsl88 6.10 summary 89 Chapter 7th Overview of other computing models 90 7.1 calculation models 92 7.1.1 Decision Table 92 7.1.2 generative rule system 93 7.1.3 state machine 94 7.1.4 dependent on network 95 7.1.5 select model 95 chapter 5 code generation 96 8th select what to generate 96 8.1 how to generate 99 8.2 mixed Generation Code and handwritten code 8.3 100 generate readable code 8.4 101 parse previous code generation 8.5 extended read 101 8.6 chapter language workbench 102 9.1 elements of language workbench 102 9.2 mode definition language and meta-model 103 9.3 source code editing and projection editing 107 9.4 descriptive programming 109 9.5 tool travel 110 language workbench and CASE tool 9.6 9.7 should we use the language workbench? 112 Part 2 use the main question Chapter 10th various dsl116 10.1graphviz116 10.2jmock117 10.3css118 201710.5xaml120 10.6fit122 10.7make and so on Chapter 123 semantic model 11th 125 working principles 11.1 use scenarios 11.3 getting started example (Java) 128 chapter 12th symbol table 129 12.1 working principles 129 12.2 use cases 131 12.3 references 131 dependency networks implemented by DSL outside 12.4 (Java and anlr) 131 12.5 use the symbol key (Ruby) in an internal DSL 133 12.6 use enumeration as the static type symbol (Java) 134 chapter 13th context variables 137 13.1 working principles 137 use cases 13.2 137 read INI files (C #) 138 Chapter 1 constructor 14th 141 working principle 14.1 use cases 141 14.2 build simple flight information (C #) 142 chapter 15th macro 144 15.1 working principles 144 15.1.1 Article 145 15.1.2 syntax macro 148 use cases 15.2 Chapter 151 notice 16th working principles 153 16.1 use cases 153 16.2 a very simple notification (C #) 154 notification in parsing (Java) 16.4 third part external DSL topic Chapter 1 delimiter guide translation 155 17th working principle 160 17.1 use cases 160 17.2 frequent customer score (C #) 163 17.3.1 semantic model 163 17.3.2 parser 165 17.4 use Miss Grant's controller to parse non-autonomous statements (Java) 168 chapter 18th syntax guidance for translation 175 18.1 working principles 175 18.1.1 lexical analyzer 176 18.1.2 syntax analyzer 179 18.1.3 generate output 181 18.1.4 semantic prediction 181 18.2 use cases 182 references 18.3 chapter bnf183 182 work principle 183 19.1.1 multiple symbols (Kleene operator) 184 19.1.2 other useful operators 186 19.1.3 parsing expression syntax 186 19.1.4 convert ebnf to basic bnf187 19.1.5 behavior code 189 19.2 use cases 191 chapter 20th lexical analyzer based on regular expression tables 192 principle 192 20.2 use cases 193 20.3 lexical processing of Miss Grant controller (Java) 194 chapter 21st recursive descent syntax parser 197 21.1 working principle 197 use cases 21.2 200 references 21.3 200 21.4 recursive descent and Miss Grant's controller (Java) 201 Chapter 2 parser combo 22nd 205 Working Principle 22.1 22.1.1 processing Action 206 22.1.2 functional style combo 208 209 Use Case 22.2 209 parser bundle and Miss Grant's controller (Java) 210 Chapter 1 Parser Generator 23rd 217 Working Principle 23.1 217 use cases 23.2 219 Hello World (Java and anlr) 219 23.3.1 write a basic grammar 220 23.3.2 build a syntax analyzer 221 23.3.3 Add code actions for the grammar 223 23.3.4 use a generation gap 225 chapter tree construction 24th 227 working principles 24.1 227 use cases 24.2 229 use anlr tree construction syntax (Java and anlr) 230 24.3.1 markup explanation 230 24.3.2 parsing 231 24.3.3 assembling a semantic model 233 24.4 constructing a tree using code actions (Java and anlr) 236 chapter 25th embedded syntax translation 242 25.1 working principles 242 use cases 25.2 243 Miss Grant's controller (Java and anlr) 243 chapter 26th embedded interpreter 247 26.1 working principle 247 use cases 26.2 247 calculator (anlr and Java) 247 chapter 27th plus code 250 27.1 working principles 250 use cases 27.2 251 embedded dynamic code (anlr, Java, and JavaScript) 252 27.3.1 semantic model 252 27.3.2 syntax analyzer 254 chapter 28th variable word segmentation method 258 28.1 working principle 258 28.1.1 character reference 259 28.1.2 lexical status 261 28.1.3 modification of tag type 262 28.1.4 ignore tag type 263 28.2 Use Cases 264 chapter 29th nested operator expressions 265 29.1 working principle 265 29.1.1 use bottom-up syntax analyzer 265 29.1.2 top-down syntax analyzer 266 29.2 use scenario 268 chapter 30th use line breaks as separators 269 30.1 working principle 269 30.2 use cases 271 chapter 31st external DSL collection 272 31.1 syntax indentation 272 31.2 modular grammar 274 fourth part internal DSL topic 32nd chapter expression generator 276 32.1 working principle 276 32.2 use cases 277 32.3 consistent calendar with and without generators (Java) 278 32.4 use multiple generators for calendars (Java) 280 chapter 33rd Function Sequence 282 33.1 working principles 282 33.2 use cases 283 33.3 simple computer configuration (Java) 283 chapter 34th nested functions 286 34.1 working principles 286 use cases 34.2 287 simple computer configuration example (Java) 34.3 288 tag multiple different parameters (C #) 289 34.5 for IDE support using child type tags (Java) 291 34.6 use object initiators (C #) 292 34.7 periodic events (C #) 293 34.7.1 semantic model 294 34.7.2dsl296 chapter 35th method cascade 299 35.1 working principle 299 35.1.1 generator or value 300 35.1.2 final problem 301 35.1.3 layered structure 301 35.1.4 progressive interface 302 35.2 Use Case 303 simple computer Configuration example (Java) 303 35.4 method cascade with attributes (C #) 306 35.5 progressive interface (C #) 307 chapter 36th object range 309 36.1 working principle 309 use cases 36.2 310 Security Code (C #) 36.3 36.3.1 semantic model 310 36.3.2dsl313 311 use instance evaluate (Ruby) 315 36.5 use the instance initialization tool (Java) 317 chapter 37th closure 319 37.1 working principles 319 use cases 37.2 chapter 323 nested closure 38th 324 working principles 38.1 use cases 324 38.2 use nested closure to wrap function sequences (Ruby) 326 38.4 simple C # example (C #) 327 38.5 use method cascading (Ruby) 328 38.6 Function Sequence with explicit closure parameters (Ruby) 330 38.7 instance-level evaluation (Ruby) 332 Chapter 1 literal structure of the list 39th 335 working principles 39.1 use cases 335 chapter 39.2 literal map336 335 working principles 40th 40.1 use cases 336 40.2 use list and map to express computer configuration information (Ruby) 337 40.4 evolution to Greenspun (Ruby) 338 chapter 41st dynamic receiving 342 41.1 working principle 342 41.2 use cases 343 41.3 points -- use method name resolution (Ruby) 344 41.3.1 model 345 41.3.2 generator 347 points-use method cascade (Ruby) 41.4 41.4.1 model 348 41.4.2 generator 349 349 remove references from the security dashboard controller (jruby) 351 chapter 42nd annotation 357 42.1 working principle 357 42.1.1 definition annotation 358 42.1.2 processing annotation 359 42.2 use cases 360 42.3 specific syntax for runtime processing (Java) 360 42.4 use class method (Ruby) 362 42.5 dynamic code generation (Ruby) 363 chapter 43rd parsing tree operation 365 43.1 working principle 365 use cases 43.2 366 IMAP query generated by C # conditions (C #) 367 43.3.1 semantic model 367 43.3.2 construct 369 43.3.3 step back 373 chapter 44th Class symbol table 375 working principle 44.1 375 Use Case 44.2 376 44.3 implement Class symbol table in static type (Java) 377 chapter 45th text retouching 383 45.1 working principles 383 use cases 45.2 383 use of retouching discount rules (Ruby) chapter 1 384 scaling 46th 386 working principles 46.1 386 use cases 46.2 387 recipe ingredients (C #) 387 Part 5 other computing models Chapter 1 adaptive model 47th 390 working principles 47.1 47.1.1 use imperative code 390 47.1.2 tool 391 393 use cases 47.2 chapter 394 Decision Table 48th 395 working principles 48.1 395 use Case 396 48.3 calculate the cost for an order (C #) 396 48.3.1 model 397 48.3.2 parser 400 chapter 49th dependency network 403 49.1 working principle 403 49.2 use cases 405 49.3 analysis beverage (C #) 405 49.3.1 semantic model 406 49.3.2 parser 407 chapter 50th generative rule system 409 50.1 working principle 409 50.1.1 chain operation 410 50.1.2 contradictory derivation 411 50.1.3 model 412 50.2 Use Case 412 50.3 club member verification (C #) 412 50.3.1 model 413 50.3.2 parser 414 50.3.3 evolution dsl414 50.4 eligibility rules: Extend club members (C #) 416 50.4.1 model 417 50.4.2 parser 419 chapter 51st state machine 421 51.1 working principle 421 51.2 use cases 423 51.3 security panel controller (Java) 423 Part 6 code generation 52nd chapter 426 converter-based code generation 52.1 426 working principle 52.2 use cases 427 52.3 security panel controller (Java-generated C) 427 chapter 53rd templated generator 431 53.1 working principle 431 use cases 53.2 432 Generate Security Control Panel state machine with nested conditions (velocity and Java-generated C) 432 chapter 54th embedded assistant 438 54.1 working principles 438 use cases 54.2 439 Security Control Panel status (Java and anlr) 54.3 439 should helper classes generate HTML (Java and velocity) 442 Chapter 1 model-based code generation 55th 444 working principles 55.1 444 use cases 55.2 445 Security Control Panel state machine (c) 55.3 445 dynamic loading state machine (c) 451 Chapter 1 code generation without model 56th 454 working principle 56.1 use cases 454 56.2 use nested conditions security panel state machine (c) 455 chapter 57th daigou 457 working principles 57.1 457 use cases 57.2 458 generate classes based on data structures (Java and some ruby) 57.3 references 459 source of this book: China Interactive publishing network

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.