the meta-environment márcio coelho pg16046 andré rocha pg12345
TRANSCRIPT
![Page 1: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/1.jpg)
TheMeta-Environment
Márcio Coelho PG16046André Rocha PG12345
![Page 2: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/2.jpg)
• ASF - Algebraic Specification Formalism
• SDF - Syntax Definition Formalism
• Rascal
![Page 3: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/3.jpg)
ASF
• Algebraic Specification Formalism
• Permite rescrita de termos e travessia de arvores genéricas
![Page 4: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/4.jpg)
SDF
• Syntax Definition Formalism
• SDF é mais rica que BNF
![Page 5: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/5.jpg)
module basic/Booleansexports sorts Boolean context-free start-symbols Booleancontext-free syntax "true" -> Boolean "false" -> Boolean lhs:Boolean "|" rhs:Boolean -> Boolean {left} lhs:Boolean "&" rhs:Boolean -> Boolean {left} "not" "(" Boolean ")" -> Boolean "(" Boolean ")" -> Boolean context-free priorities Boolean "&" Boolean -> Boolean > Boolean "|" Boolean -> Boolean
![Page 6: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/6.jpg)
Operações
• Parser
• Análise de código
• Transformação de código
• Criação, implementação e compilação de DSL
![Page 7: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/7.jpg)
IDE
![Page 8: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/8.jpg)
Anatomia
![Page 9: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/9.jpg)
Estrutura de um Modulo
module ModuleName ImportSection* ExportOrHiddenSection*equations ConditionalEquation*
![Page 10: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/10.jpg)
Exemplo ASF+SDF
![Page 11: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/11.jpg)
Import MyBooleansimports basic/Whitespaceimports basic/Booleans
exportscontext-free syntax
Boolean “xor” Boolean --> Boolean
hiddenscontext-free start-symbols Boolean
![Page 12: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/12.jpg)
Equations[xor-1] true xor true = false[xor-2] true xor false = true[xor-3] false xor true = true[xor-4] false xor false = false
![Page 13: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/13.jpg)
CMinus
![Page 14: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/14.jpg)
module Desktop/Cminus/Types
exports
sorts TYPEcontext-free syntax "char" -> TYPE "int" -> TYPE "nil-type" -> TYPE
module Desktop/Cminus/Iden
exportssorts ID lexical syntax [a-z][a-zA-Z0-9]* -> ID
context-free restrictions ID -/- [a-zA-Z0-9]
![Page 15: The Meta-Environment Márcio Coelho PG16046 André Rocha PG12345](https://reader030.vdocuments.mx/reader030/viewer/2022020217/552fc0f8497959413d8b5fbd/html5/thumbnails/15.jpg)
context-free syntax
DECLARATION+ -> PROGRAM
context-free syntax
VARIABLE -> DECLARATIONFUNCTION -> DECLARATION
context-free syntax
TYPE ID ";" -> VARIABLE
context-free syntax
TYPE ID "(" ( FORMALPARAMETER ("," FORMALPARAMETER)* )? ")" BLOCK -> FUNCTION
context-free syntax
TYPE ID -> FORMALPARAMETER
context-free syntax
"{" VARIABLE* STAT* "}" -> BLOCK