Modelling Parsing and Unparsing Vadim Zaytsev Anya Helene Bagge - - PowerPoint PPT Presentation

modelling parsing and unparsing
SMART_READER_LITE
LIVE PREVIEW

Modelling Parsing and Unparsing Vadim Zaytsev Anya Helene Bagge - - PowerPoint PPT Presentation

Modelling Parsing and Unparsing Vadim Zaytsev Anya Helene Bagge University of Amsterdam University of Bergen Parsing@SLE 2014-09-14 Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 1 / 10 SLE Artifacts String


slide-1
SLIDE 1

Modelling Parsing and Unparsing

Vadim Zaytsev Anya Helene Bagge

University of Amsterdam University of Bergen

Parsing@SLE 2014-09-14

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 1 / 10

slide-2
SLIDE 2

SLE Artifacts

String

  • Token List
  • Parse Tree
  • Zaytsev & Bagge (UvA/UiB)

Modelling Parsing and Unparsing 2014-09-14 2 / 10

slide-3
SLIDE 3

Te Megamodel

Str

(string)

Tok

(tokens)

TTk

(typed tokens)

Lex

(lexical model)

For

(parse forest)

Ptr

(parse tree)

Cst

(concrete syntax tree)

Ast

(abstract syntax tree)

Pic

(rasterised picture)

Dra

(vector drawing)

Gra

(graph model)

Dia

(diagram)

tokenise c

  • n

c a t strip format parse unparse parse unparse s t r i p f

  • r

m a t i m p l

  • d

e e x p l

  • d

e d i s a m b i g u a t e r e c

  • g

n i s e r e n d e r s t r i p f

  • r

m a t e x t r a c t flatten scannerless parse unparse visualise serialise m2m text editing structural editing m2m transformation refactoring code transformation filtering drawing visual editing Raw Layout Layoutless Abstract Textual Structured Graphical

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 3 / 10

slide-4
SLIDE 4

Classic (Lex+Yacc) Parsing

Str

(string)

Tok

(tokens)

TTk

(typed tokens)

Lex

(lexical model)

For

(parse forest)

Ptr

(parse tree)

Cst

(concrete syntax tree)

Ast

(abstract syntax tree)

Pic

(rasterised picture)

Dra

(vector drawing)

Gra

(graph model)

Dia

(diagram)

scan parse Raw Layout Layoutless Abstract Textual Structured Graphical

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 4 / 10

slide-5
SLIDE 5

Code Formatting

Str

(string)

Tok

(tokens)

TTk

(typed tokens)

Lex

(lexical model)

For

(parse forest)

Ptr

(parse tree)

Cst

(concrete syntax tree)

Ast

(abstract syntax tree)

Pic

(rasterised picture)

Dra

(vector drawing)

Gra

(graph model)

Dia

(diagram)

concat format unparse Raw Layout Layoutless Abstract Textual Structured Graphical

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 5 / 10

slide-6
SLIDE 6

Rascal

Str

(string)

Tok

(tokens)

TTk

(typed tokens)

Lex

(lexical model)

For

(parse forest)

Ptr

(parse tree)

Cst

(concrete syntax tree)

Ast

(abstract syntax tree)

Pic

(rasterised picture)

Dra

(vector drawing)

Gra

(figure)

Dia

(diagram)

implode filter render scannerless parse unparse unparse Raw Layout Layoutless Abstract Textual Structured Graphical

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 6 / 10

slide-7
SLIDE 7

Lowered Transformations Ast Ast

transform

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 7 / 10

slide-8
SLIDE 8

Lowered Transformations Ast Ast

transform

Cst Cst

implode transform explode

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 7 / 10

slide-9
SLIDE 9

Lowered Transformations Ast Ast

transform

Cst Cst

implode transform explode

Ptr Ptr

strip format transform

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 7 / 10

slide-10
SLIDE 10

Lowered Transformations Ast Ast

transform

Cst Cst

implode transform explode

Ptr Ptr

strip format transform

Str Str

parse unparse t r a n s f

  • r

m

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 7 / 10

slide-11
SLIDE 11

Composing Transformations

Str

(string)

Tok

(tokens)

TTk

(typed tokens)

Lex

(lexical model)

For

(parse forest)

Ptr

(parse tree)

Cst

(concrete syntax tree)

Ast

(abstract syntax tree)

Pic

(rasterised picture)

Dra

(vector drawing)

Gra

(graph model)

Dia

(diagram)

concat format unparse Raw Layout Layoutless Abstract Textual Structured Graphical

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 8 / 10

slide-12
SLIDE 12

Composing Transformations

Str

(string)

Tok

(tokens)

TTk

(typed tokens)

Lex

(lexical model)

For

(parse forest)

Ptr

(parse tree)

Cst

(concrete syntax tree)

Ast

(abstract syntax tree)

Pic

(rasterised picture)

Dra

(vector drawing)

Gra

(graph model)

Dia

(diagram)

concat format unparse parse Raw Layout Layoutless Abstract Textual Structured Graphical

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 8 / 10

slide-13
SLIDE 13

Composing Transformations

Str

(string)

Tok

(tokens)

TTk

(typed tokens)

Lex

(lexical model)

For

(parse forest)

Ptr

(parse tree)

Cst

(concrete syntax tree)

Ast

(abstract syntax tree)

Pic

(rasterised picture)

Dra

(vector drawing)

Gra

(graph model)

Dia

(diagram)

concat format unparse parse filter Raw Layout Layoutless Abstract Textual Structured Graphical

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 8 / 10

slide-14
SLIDE 14

Composing Transformations

Str

(string)

Tok

(tokens)

TTk

(typed tokens)

Lex

(lexical model)

For

(parse forest)

Ptr

(parse tree)

Cst

(concrete syntax tree)

Ast

(abstract syntax tree)

Pic

(rasterised picture)

Dra

(vector drawing)

Gra

(graph model)

Dia

(diagram)

concat format unparse parse filter strip Raw Layout Layoutless Abstract Textual Structured Graphical

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 8 / 10

slide-15
SLIDE 15

Is it Useful?

Explain representations and transformations to students Explain what you mean with “parsing” in your paper Simplify dealing with bidirectional transformations Amaze your friends with fancy graphic models in your papers

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 9 / 10

slide-16
SLIDE 16

Conclusion

We have identified SLE artifacts and translations between them Prototype w/transformations: https://github.com/grammarware/bx-parsing The full paper:

Vadim Zaytsev and Anya Helene Bagge. Parsing in a Broad Sense. In Jurgen Dingel and Wolfram Schulte, editors, Proceedings of the 17th International Conference on Model Driven Engineering Languages and Systems (MODELS’14), volume 8767 of LNCS, pages 50–67. Springer, 2014.

Zaytsev & Bagge (UvA/UiB) Modelling Parsing and Unparsing 2014-09-14 10 / 10