Skip this Video
Download Presentation

Loading in 2 Seconds...

play fullscreen
1 / 101

Stratego - PowerPoint PPT Presentation

  • Uploaded on

Stratego. Song Zhou *Include slides from Introduction. Stratego is “ a language for the specification of transformation systems based on the paradigm of program rewriting strategies ” . Basic components:

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about ' Stratego' - dorcas

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript


Song Zhou

*Include slides from

  • Stratego is “a language for the specification of transformation systems based on the paradigm of program rewriting strategies”.
  • Basic components:
    • Rules: basic transformation steps
    • Strategies: control application of rules
stratego xt
  • Stratego is only a term-rewriting language. “Term in, Term out.” XT can combine Stratego with other tools to create a transformation system.
  • Front End:
    • SGLR: a generic parser creating syntax tree
  • Back End:
    • GPP: a generic pretty-printer to emit the syntax tree out
  • Communication Language
    • Aterm: a term exchange format
what is wrong with abstract syntax
What is wrong with Abstract Syntax
  • Problems
    • Easy for computer to process
    • Difficult for human being to read and write
    • Maybe to verbose to be specified
  • Solution
    • Directly employ the concrete object syntax to specify the rewriting rules in Stratego
mix an object language with a meta language
Mix an Object Language With a Meta Language
  • Object Language inside Meta Language:
    • Extending Meta Language witha quotation operator that lets the meta-programmer indicate object languagefragments.
  • Meta Language inside Object Language:
    • Antiquotation allows the use of meta-programming languageconstructs in these object language fragments to splice meta-computed objectcode into a fragment.
  • If Meta Language equals Object Language then the syntax extension is easy by justadding quote and antiquote operators to Meta Language.
  • EvalPlus : |[ i + j ]| -> |[ k ]|where <add>(i, j) => k
  • TraceProcedure : |[ function ~f(~* xs) = ~e ]| -> |[ function ~f(~* xs) = (print(~String(<conc-strings>(f," entry\\n"))); ~e; print(~String(<conc-strings>(f,"exit\\n"))))]|
syntax definition formalism
Syntax Definition Formalism
  • Both the Stratego syntax and the object language syntax is specified using the Syntax Definition Formalism (SDF)
  • AnSDF production sym1 ... symn -> sym declares that an expression of sort symcan be constructed by the concatenation of expressions of sorts sym1 to symn.
  • SDF supports regular expression operators such as {Exp ";"}*, which denotesa list of Expressions separated by ; semicolons.
  • SDF integrates thedefinition of lexical and context-free syntax in one formalism.
  • The formalismis modular
    • the syntax definition of a language can be divided intosmaller (reusable) modules
    • syntax definitions for separate languages caneasily be combined.
syntax combination
Syntax Combination
  • The object language syntax definition can be imported into Stratego syntax definition
  • We also need define an additional combinationial syntax definiton, to specify the glues (quotation mark and antiquotaion mark)
theoretical problems
Theoretical Problems
  • Only full class of CFG have closure property. LL, LR and other subclasses of CFG are not closed under composition.
  • SDF2 supports scannerless generalized-LR parsing
  • Rules rewriting
  • Transformation strategy
  • First-Class Pattern Matching
  • Scoped Dynamic Rewrite Rules
  • Concrete Object Syntax