rapid resource api design language€¦ · new syntax – indents define block scope previous...

78
RAPID – Resource API Design Language Pushing the limits of language usability with XText TED EPSTEIN, FOUNDER AND CEO TANYA FESENKO, LEAD DEVELOPER EclipseCon NA 2015, Xtext Day 1 COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED.

Upload: others

Post on 04-Jul-2020

18 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

RAPID – Resource API Design LanguagePushing the limits of language usability with XText

TED EPSTEIN, FOUNDER AND CEO

TANYA FESENKO, LEAD DEVELOPER

Ecl ipseCon NA 2015, Xtext Day

1COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED.

Page 2: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Overview• RepreZen: solving API interoperability• Challenge: a better API description language• RAPID Language Features

◦ Optional Fluency: accommodating coding styles

◦ Keyword Sequence: encourage, don’t Enforce

◦ Indent-Based Block Scoping: life without curly braces

• Implementation Overview• Summary• Q&A

2COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED.

Page 3: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED. 3

/ Unify Data Models

/ Federate APIs

/ Integrate Faster

The Elevator Pitch

Page 4: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

The Elevator Pitch

COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED. 4

Make Canonical Data Models

Practical

Enable Highly Interoperable

APIs

Significantly Lower Long-

Term Integration Cost

• Frequently recommended, hard to implement• Current reality: much easier to build from

scratch than to reuse existing data models• We want to change that!

Page 5: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED. 5

Make Canonical Data Models

Practical

Enable Highly Interoperable

APIs

Significantly Lower Long-

Term Integration Cost

• Frequently recommended, hard to implement• Current reality: much easier to build from

scratch than to reuse existing data models• We want to change that!

• Reusable data models: business-oriented,technology-independent, semantically rich

• Allow variability through realization• Message payloads still conform to canonical model

Property Subsets Perspective

<party dataSource=“MSDB”>

<partyId>123</partyId>

<partyName xsi:nil=“true” nullValue=“Not Available” />

<accounts>

<account dataSource=“A2” transType=“insert”>

<accountId>XYZ</accountId>

<balance xsi:nil=“true” isRestricted=“true” />

</account>

</accounts>

</party>

Metadata Contextual Constraints

The Elevator Pitch

Page 6: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED. 6

Make Canonical Data Models

Practical

Enable Highly Interoperable

APIs

Significantly Lower Long-

Term Integration Cost

• Frequently recommended, hard to implement• Current reality: much easier to build from

scratch than to reuse existing data models• We want to change that!

• Reusable data models: business-oriented, technology-independent, semantically rich

• Allow variability through realization• Message payloads still conform to canonical model

• Service APIs speak the same language• Clients can work with multiple APIs, without multiple DTOs,

SDKs, etc.• Stop runaway spending on remedial integration technology

Page 7: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Changing the way we build APIs

Message Schema

COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED. 7

Business DomainModel

Realization

• Subset• Perspective• Constraints• Metadata

Resource Data

Model

Representation

• Media Type• Format• Conventions• Hyperlinks

This needs to be built into the API modeling language.

Page 8: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Yet Another API Description Language?YAADL? YAAPIDL?There are at least four of these...

“The nice thing about standards is that you have so many to chose from.”- Andrew Tanenbaum

COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED. 8

… and they’re pretty good.◦ Web-based editors◦ API Documentation with integrated

sandbox◦ Syntax based on YAML or Markdown◦ Interesting language-level reuse◦ REST patterns built in

If we have to build an API

modeling language, it has to be good.

… any ideas?

Page 9: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Who’s going to model these APIs?

COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED. 9

…andDevelopers!Developers!

Developers!

Business Analysts

Subject Matter Experts

Data Professionals

Enterprise Architects

Make it accessible, readable, versatile.

What she said.

Page 10: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Demo – RAPID Usability Features• Indent Syntax:

◦ Python-like block syntax, no curly braces◦ Advanced highlighting to visualize structure

• Order Assist:◦ Flexible sequence for declarations ◦ Reset to standard sequence using QuickFix or auto-format

• Optional Fluency◦ Support terse and fluent syntax with optional keywords◦ Semantic highlighting to distinguish optional vs. required keywords

COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED. 10

Page 11: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

11

Indent-Based Syntax

Structural Highlighting -editbox.sourceforge.net

New Syntax –indents define block scope

Previous Syntax –braces for block scoping

Page 12: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Order Assist

12

Page 13: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Optional Fluency

13

Fluent

Terse

Page 14: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Implementation Walkthrough

COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED. 14

Page 15: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

15

Work with Xtext

XtextGrammar

(*.xtext file)

Page 16: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

16

Work with Xtext

XtextGrammar

(*.xtext file)Generated code (Parser and UI)

Page 17: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

17

Work with Xtext

The rest (customized from generated code)

Lexer Formatter Content assistCode

TemplatesPrefs

Cross-reference

Scope

Code highlighter

Validation/Quickfix

Outline …

XtextGrammar

(*.xtext file)Generated code (Parser and UI)

Page 18: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Description GrammarCode

Customization

for (each feature):

18

Three features

Page 19: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Feature 1:Automate canonical ordering

19

Page 20: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Order Assist

20

methods

Page 21: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

21

Implementation: Grammar

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Page 22: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

22

Allow arbitrary order in grammar

Page 23: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

23

Allow arbitrary order in grammar

Page 24: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

24

Allow arbitrary order in grammarDisable code-assist and add

validator for duplicate single-valued properties to prevent

overriding

Page 25: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

25

Sort List< INode>

Compare INodes:• Using sorting rules• Preserving:

• List delimiters• Whitespaces• Attached symbols (*, +)• Order of elements of the same

kind

Grammar Tree

Sorting rule: Sequence<GrammarElement>

Page 26: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

26

Implementation: Grammar

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Validation

Page 27: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Validation

27

MyJavaValidator # checkMyElement(SemanticElement)

Page 28: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Validation

28

Semantic Element

Syntax Tree Node

getIncorrectlyOrderedChildren()

Incorrectly ordered Nodes

NodeModelUtils::getNode()

MyJavaValidator # checkMyElement(SemanticElement)

Page 29: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

29

Implementation: Grammar

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Formatter

Page 30: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

30

FormatterDefaultNodeModelFormatter#format():

Page 31: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

31

FormatterDefaultNodeModelFormatter#format():

Page 32: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

32

FormatterDefaultNodeModelFormatter#format():

INode:• offset• text• length• grammarElement• semanticElement

Page 33: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

33

FormatterDefaultNodeModelFormatter#format():

Writes tokens to character stream and

then flushes it

The write methods create

formatted LineEntries with use of formatter

configuration (ElementLocators)

Page 34: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

34

FormatterDefaultNodeModelFormatter#format():

TextRegion –offset and

length in the char stream populated in

the write methods

Page 35: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

35

FormatterDefaultNodeModelFormatter#format():

Place for customization

Page 36: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

36

Implementation: Grammar

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Preferences page

Page 37: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Usability: Preferences

37

Page 38: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

38

Testing

1

2

3

4

5

How many permutations for five

elements ?

5!=120

Page 39: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

39

TestingXtend Active Annotations

120 green tests!

Page 40: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

40

Changes: Automate Canonical Ordering

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Preferences pageFormatterValidation

Enable arbitrary order

Page 41: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

41

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Preferences pageFormatterValidation

• Errors for single-value property override

• Warnings for "incorrect" order

Changes: Automate Canonical Ordering

Page 42: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

42

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Preferences pageFormatterValidation

Restore canonical order

Changes: Automate Canonical Ordering

Page 43: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

43

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Preferences pageFormatterValidation

enable/disable validation,

reordering in formatter

Changes: Automate Canonical Ordering

Page 44: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Feature 2: Optional fluency

44

Page 45: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

What is Optional Fluency?

45

Fluent

Terse

Page 46: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

46

Implementation: Grammar

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Page 47: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Implementation

47

Page 48: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

48

Implementation

Page 49: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

49

Changes: Optional Fluency

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Optional fluency

Page 50: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Feature 3: Indent-based block scoping in Xtext

50

Page 51: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

51

Indent-based block scoping in Xtext

Python-like notation

With curly braces

Page 52: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

52

Indent-based block scoping in Xtext

Highlighting of boxes-editbox.sourceforge.net

Page 53: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

53

Implementation: Grammar

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Page 54: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

54

Grammar

NL - newlineWS – whitespaceBEGIN – indentEND - outdent

Page 55: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

55

Grammar NL: not hidden

NL - newlineWS – whitespaceBEGIN – indentEND - outdent

Page 56: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

56

Grammar NL: not hidden

NL - newlineWS – whitespaceBEGIN – indentEND - outdent

Page 57: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

57

Implementation: Grammar

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Lexer

Page 58: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

58

Custom Lexer

Custom code

Generated / Xtext code

Indent-based Syntax in Xtext -tinyurl.com/pgcowct

Insert BEGIN and END token

Page 59: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

59

Content assist

Page 60: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

60

Implementation: Grammar

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Content Assist

Page 61: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

61

Custom LexersPlural now

Custom code

Generated / Xtext code

Content-assist needs its own lexer

Page 62: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Custom Lexers

62

Custom code

Generated / Xtext code

Page 63: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Content Assist

63

Also see “Enhancing Content Assist” from

XtextCON 2015 -tinyurl.com/onou2hu

Page 64: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Content Assist

64

Also see “Enhancing Content Assist” from

XtextCON 2015 -tinyurl.com/onou2hu

Page 65: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Content Assist

65

Also see “Enhancing Content Assist” from

XtextCON 2015 -tinyurl.com/onou2hu

Page 66: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Content Assist

66

Place for customization

Page 67: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Content-Assist Context Factory

67

Initialize dataAnalyze data to create content assist contexts

Content Assist

Contexts

Page 68: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Content-Assist Context Factory

68

Initialize dataAnalyze data to create content assist contexts

Content Assist

Contexts

Syntax tree nodes –lastCompleteNode, lastVisibleNode, currentNode, datatypeNodeSemantic model - current model

Page 69: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Initialize dataAnalyze data to create content assist contexts

Content Assist

Contexts

Content-Assist Context Factory

69

Start a new token, complete current one, collect available alternatives, etc…

Page 70: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Initialize dataAnalyze data to create content assist contexts

Content Assist

Contexts

Content-Assist Context Factory

70

Customize to respect indents

Page 71: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

71

Implementation: Grammar

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

Formatter

Page 72: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Formatter

72

Assign correct value to FormattingConfigBasedStream#indentationLevel

No spaces around “invisible” rules – synthetic (BEGIN and END) and NL (newline)

No line wraps should be introduced by formatter – line wraps change structure of Python-like models

Page 73: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

73

Changes: Indent-based Syntax

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

FormatterContentAssistLexer

Add BEGIN and END terminal

rules

Page 74: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

74

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

FormatterContentAssistLexer

Synthesize BEGIN and END

tokens

Changes: Indent-based Syntax

Page 75: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

75

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

FormatterContentAssistLexer

Show proposals according to indent level

Changes: Indent-based Syntax

Page 76: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

76

The rest (customized from generated code)

XtextGrammar

(*.xtext file)Generated code

FormatterContentAssistLexer

Preserve NLs and indents

Changes: Indent-based Syntax

Page 77: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

Summary• Still an ongoing experiment

◦ Early feedback from users has been very positive.◦ We welcome your feedback!

• API Studio is a commercial product, still pre-launch

• Offering a free license with 1-year maintenance to Conference attendees (1 per organization)

• Register at get.reprezen.com with invitation code eclipsecon2015

• Contacts:◦ [email protected][email protected]

COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED. 77

Page 78: RAPID Resource API Design Language€¦ · New Syntax – indents define block scope Previous Syntax – braces for block scoping. Order Assist 12. Optional Fluency 13 Fluent Terse

QuestionsTHANK YOU!

COPYRIGHT © 2015, MODELSOLV, INC. | ALL RIGHTS RESERVED. 78