Intermediate representations of functional programming languages for software quality control
|
|
- Clara Cameron
- 6 years ago
- Views:
Transcription
1 Intermediate representations of functional programming languages for software quality control Melinda Tóth, Gordana Rakić Eötvös Loránd University Faculty of Informatics University of Novi Sad Chair of Computer Science Aug. 27., 2013 The 13 th Workshop on "Software Engineering Education and Reverse Engineering" T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 1 / 31
2 Static Analyser Tools Motivation RefactorErl Static source code analyser and transformer Erlang SSQSA Set of Software Quality Static Analyzers Language independent T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 2 / 31
3 Static Analyser Tools Motivation RefactorErl Code Comprehension Refactoring Query Language Clone detection Metrics Dependence analysis SSQSA Clone detection Metrics Software network analysis Analyze evolutionary changes T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 3 / 31
4 Static Analyser Tools Motivation RefactorErl Semantic Program Graph, SPG SSQSA Enriched Concrete Syntax Tree, ecst T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 4 / 31
5 Static Analyser Tools Motivation RefactorErl Semantic Program Graph, SPG SSQSA Enriched Concrete Syntax Tree, ecst T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 5 / 31
6 SSQSA SSQSA T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 6 / 31
7 RefactorErl Erlang Functional Highly concurrent Distributed Fault-tolerant Supervisor Soft real-time Hot code swap Erlang VM T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 7 / 31
8 RefactorErl History Started in 2006 Software Technology Lab (4*4 ECTS) since 2008 One of the 8 labs students (BSc, MSc, PhD) ELTE-Ericsson Software Technology Lab since 2011 T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 8 / 31
9 RefactorErl RefactorErl Static source code analyser and transformer tool for Erlang Refactoring less error prone & fast Program comprehension Support in everyday work & debugging & complex tasks, e.g. Rename a function, search definition Find the value of a variable Program comprehension, component relation detection Program restructuring T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 9 / 31
10 RefactorErl (cont.) RefactorErl Platform for source code transformations 24 implemented refactorings Rename/Move definition Expression structure Function interface Structural source code analysis Clustering Support program comprehension Call graph visualisation Dependency analysis Semantic Query Language / Metric Query Language T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 10 / 31
11 User Interfaces RefactorErl T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 11 / 31
12 RefactorErl Semantic Program Graph 1 Lexical level Tokens Preprocessing Comments, whitespace 2 Syntactic level Abstract Syntax Tree Files 3 Semantic level Module, function, record, variable nodes Links to definition and reference points T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 12 / 31
13 RefactorErl -module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put_chars(?eol(s)). my.erl function put_chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put_chars (? EOL ( S ) ). T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31
14 RefactorErl -module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put_chars(?eol(s)). my.erl function put_chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put_chars (? EOL ( S ) ). T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31
15 RefactorErl -module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put_chars(?eol(s)). my.erl function put_chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put_chars (? EOL ( S ) ). T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31
16 RefactorErl -module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put_chars(?eol(s)). my.erl function put_chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put_chars (? EOL ( S ) ). T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31
17 RefactorErl -module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put_chars(?eol(s)). my.erl function put_chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put_chars (? EOL ( S ) ). T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31
18 RefactorErl -module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put_chars(?eol(s)). my.erl function put_chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put_chars (? EOL ( S ) ). T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31
19 RefactorErl -module(my). -define(eol(x), X ++ "\n"). f(s) -> io:put_chars(?eol(s)). my.erl function put_chars my modq var atom atom f io app S ++ var string S ++ "\n" f ( S ) -> io : put_chars (? EOL ( S ) ). T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 13 / 31
20 variable 32 S ) 13 ) llex/3 llex/1 arg ( 11 ( form/2 llex/1 atom 8 define llex/2 flex/5 variable 12 X param orig/1 ( 9 ( flex/2 flex/3 variable 10 EOL flex/4 llex/4 flex/6, 14, mref/1 ( 31 ( flex/7 body variable 15 X vardef/1 llex/3 llex/1 token subst ) 33 ) llex/1 llex/5 flex/8 ) 18 ) RefactorErl varvis/1 llex/1? 29? llex/2 flex/9 stop flex/1 llex/3 visib/1 varintro/1 llex/1 llex/2 variable 30 EOL ) 23 ) varbind/1 varref/1 token string 17 " " clex/2 -> 24 llex/1 -> orig/1 clex/3 variable 22 S name/1 atom 20 f token orig/1 esub/2 flow/1 functx/1scope/1 clex/1 esub/1 flow/1 dep/1 flow/1 atom 27 put_chars ( 21 ( esub/1 funcl/1 dep/1 esub/2 stop 35. pattern/1 : 26 : flex/1 esub/1 ( 28 ( flow/1 body/1 esub/2 esub/1 module 2 module modctx/1 visib/2 elex/2 ) 34 ) atom 25 io dep/1 form/3 flex/2 ( 3 ( fundef/1 flex/3 atom 4 my flex/4 form/1 flex/5 ) 5 ) fpar/1 flow/1 funeref/1 modref/1 fpar/1 incl/1 flex/6 fret/1 func/1 stop 6. fret/1 file/1 flex/1 func/1-1 - funcall/1 moddef/1 module/1 module/2 Example graph ROOT my.erl function form clause 1 fundef expr 1 atom f my f/1 undefined 11 fpar pattern 2 variable S expr 6 variable S S expr 8 infix_expr ++ expr 7 string expr 10 application expr 5 expr 9 infix_expr : arglist undefined 12 fret form expr 4 atom put_chars expr 3 atom io io put_chars/1 undefined 13 undefined 14 fpar fret T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 14 / 31
21 Analysis Details RefactorErl Extended syntax description Defines the representation Source for parser, lexer, and token updater Semantic Analyser framework Extensible, modular structure Works on syntactic subtrees (incremental) Asynchronous parallel execution Side-effect analysis, data-flow analysis, dynamic function call analysis T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 15 / 31
22 Mapping Mapping Attila Páter-Részeg, TDK Thesis, Scientific Student Association Conference, June 2013 convert: SG ECST convert N : SG N ECST M file form... COMPILATION_UNIT FUNCTION_DECL... T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 16 / 31
23 Simple Erlang Module Mapping -module(a). f() -> ok. T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 17 / 31
24 Mapping SPG representation for module a ROOT file/1 a.erl incl/1 form/2 form/1 module/1 function form moddef/1 flex/1 funcl/1 flex/1 flex/2 flex/3 flex/4 flex/5 flex/6 stop 12. clause 1 fundef functx/1scope/1-1 - module 2 module ( 3 ( atom 4 a ) 5 ) stop 6. fundef/1 modctx/1 clex/3 body/1 visib/1 name/1 clex/1 clex/2 a -> 10 -> expr 2 atom ok expr 1 atom f ( 8 ( ) 9 ) func/1 f/0 flow/1 atom 11 ok atom 7 f fret/1 undefined 3 fret T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 18 / 31
25 Mapping XML representation for module a T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 19 / 31
26 Mapping ecst representation for module a T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 20 / 31
27 Mapping Example: convert function (x) = y Erlang source code f( ) -> ok. Imperative source code private any f( ){ ok; } T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 21 / 31
28 Mapping Example: convert function (x) = y Erlang source code -export([f/0]). f( ) -> ok. Imperative source code public any f( ){ ok; } T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 22 / 31
29 Mapping Example: convert function (x) = y Erlang source code -export([f/2]). f(a, B) -> ok. Imperative source code public any f(any Var1, any Var2){ ok; } T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 23 / 31
30 Mapping Example: convert function (x) = y Erlang source code -export([f/2]). f(a, A) -> ok. Imperative source code public any f(any Var1, any Var2){ if(var1 == Var2) ok; } T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 24 / 31
31 Mapping Example: convert function (x) = y Erlang source code -export([f/2]). f(a, A) -> ok; f(_, _) -> nok. Imperative source code public any f(any Var1, any Var2){ if(var1 == Var2) ok; else nok; } T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 25 / 31
32 Mapping The steps of the mapping Exported public/private Return value, type any Formal parameter list new variable Pattern matching, guards branching conditions T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 26 / 31
33 Simple Erlang Module Mapping -module(a). -export([f/2]). f(a, A) -> ok; f(_, _)-> nok. T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 27 / 31
34 atom 23 f ( 24 ( variable 27 A, 26, ) 28 ) -> 29 variable 25 A -> stop 40. atom 30 ok ; 31 ; Mapping _ 34 _ atom 39 nok ( 33 ( _ 36 _, 35, ( 3 ( atom 32 f atom 4 a ) 5 ) ) 37 ) stop 6. -> 38 -> module 2 module export 14 export ( 15 ( ) 21 ) stop 22. atom 17 f ] 20 ] / 18 / integer 19 2 [ 16 [ SPG representation for module a ROOT file/1 a.erl incl/1 form/3 form/1 form/2 module/1 function form form funcl/1 flex/2 flex/1 moddef/1 funcl/2 flex/3 flex/4 flex/5 flex/6 flex/1 flex/2 flex/2 flex/3 flex/4 flex/5 flex/1 eattr/1 clause 2 fundef functx/1scope/1 clause 3 fundef functx/1scope/1 attr 7 funlist name/1 clex/1 clex/2 clex/3 clex/4 modctx/1 visib/3 body/1 modctx/1 fundef/1 visib/3 body/1 clex/1 clex/2 name/1 clex/3 clex/4 elex/2 esub/1 expr 8 atom f a expr 11 atom ok expr 15 atom nok expr 12 atom f attr 6 funref funexp/1 func/1 funlref/1 esub/1 esub/2 visib/1 pattern/1 f/2 flow/1 visib/1 flow/1 pattern/1 visib/2 pattern/2 attr 4 atom f attr 5 integer 2 pattern/2 visib/2 fpar/2 fpar/1 fret/1 varvis/1 vardef/1 undefined 18 fpar undefined 17 fpar undefined 16 fret flow/1 flow/2 flow/2 pattern 9 flow/1 variable A pattern 13 joker pattern 14 joker flow/1 pattern 10 variable A varbind/1 varintro/1 varref/1 A T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 28 / 31
35 Mapping ecst representation for module a T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 29 / 31
36 Results Results Defined Mapping Syntax driven, recursive Prototype implementation Available through RefactorErl T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 30 / 31
37 Results Future Work Refinements of the mapping Direct connection between the two tools Validating the results, example: Compare the value of metrics Evaluate the result T., Melinda, R., Gordana (ELTE-IK, PERUN) RefactorErl & SSQSA DAAD-WS 31 / 31
Detecting and Visualising Process Relationships in Erlang
Procedia Computer Science Volume 29, 2014, Pages 1525 1534 ICCS 2014. 14th International Conference on Computational Science Melinda Tóth and István Bozó Eötvös Loránd University, Budapest, Hungary {tothmelinda,
More informationTeaching Principles of Dependable Distributed Software
Teaching Principles of Dependable Distributed Software Zoltán Horváth hz@inf.elte.hu Faculty of Informatics, Eötvös Loránd University, Budapest 14th Workshop on Software Engineering Education and Reverse
More informationTowards the Code Clone Analysis in Heterogeneous Software Products
Towards the Code Clone Analysis in Heterogeneous Software Products 11 TIJANA VISLAVSKI, ZORAN BUDIMAC AND GORDANA RAKIĆ, University of Novi Sad Code clones are parts of source code that were usually created
More informationTeaching Functional Programming
Zoltán Horváth hz@inf.elte.hu lecturers: István Bozó, Zoltán Csörnyei, Andrea Kovács, Gábor Páli, Máté Tejfel, Melinda Tóth Faculty of Informatics, Eötvös Loránd University, Budapest 15th Workshop on Software
More informationRecovering Erlang AST from BEAM bytecode
Recovering Erlang AST from BEAM bytecode Dániel Lukács and Melinda Tóth Eötvös Loránd University HU, Faculty of Informatics This research has been supported by the Hungarian Government through the New
More informationEgy Erlang Refaktor Lépés: Függvényparaméterek Összevonása Tuple-ba
Egy Erlang Refaktor Lépés: Függvényparaméterek Összevonása Tuple-ba TDK Dolgozat Nagy Tamás és Víg Anikó e-mail: {n_tamas viganiko}@inf.elte.hu Konzulensek: Horváth Zoltán és Simon Thompson Programozási
More informationStatic rules of variable scoping in Erlang
Proceedings of the 7 th International Conference on Applied Informatics Eger, Hungary, January 28 31, 2007. Vol. 2. pp. 137 145. Static rules of variable scoping in Erlang László Lövei, Zoltán Horváth,
More informationGeneric syntactic analyser: ParsErl
Generic syntactic analyser: ParsErl Róbert Kitlei, László Lövei, Tamás Nagy, Anikó Nagyné Vig, Zoltán Horváth, Zoltán Csörnyei Department of Programming Languages and Compilers, Eötvös Loránd University,
More informationLAYOUT PRESERVING PARSER FOR REFACTORING IN ERLANG
54 Acta Electrotechnica et Informatica, Vol. 9, No. 3, 2009, 54 63 LAYOUT PRESERVING PARSER OR REACTORING IN ERLANG Róbert KITLEI, László LÖVEI, Tamás NAGY, Zoltán HORVÁTH, Tamás KOZSIK Department of Programming
More informationToward Language Independent Worst-Case Execution Time Calculation
10 Toward Language Independent Worst-Case Execution Time Calculation GORDANA RAKIĆ and ZORAN BUDIMAC, Faculty of Science, University of Novi Sad Set of Software Quality Static Analyzers (SSQSA) is a set
More informationWhere shall I parallelize?
Where shall I parallelize? Judit Dániel Tamás Melinda István Viktória Zoltán Kőszegi Horpácsi Kozsik Tóth Bozó Fördős Horváth Eötvös Loránd University and ELTE-Soft Kft. Budapest, Hungary Erlang User Conference
More informationPrinciples of Programming Languages COMP251: Syntax and Grammars
Principles of Programming Languages COMP251: Syntax and Grammars Prof. Dekai Wu Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong, China Fall 2006
More informationecst to Source Code Generation - an Idea and Perspectives
ecst to Source Code Generation - an Idea and Perspectives N. Rakić *, G. Rakić **, N. Sukur ** and Z. Budimac ** * Lucid Code Industries, Novi Sad, Serbia ** University of Novi Sad, Faculty of Sciences,
More informationInterpreters. Prof. Clarkson Fall Today s music: Step by Step by New Kids on the Block
Interpreters Prof. Clarkson Fall 2017 Today s music: Step by Step by New Kids on the Block Review Previously in 3110: functional programming modular programming data structures Today: new unit of course:
More informationAnalysing and visualising callback modules of Erlang generic server behaviours
Analysing and visualising callback modules of Erlang generic server behaviours István Bozó bozoistvan@caesar.elte.hu Melinda Tóth tothmelinda@caesar.elte.hu Mátyás Béla Kuti matyas.kuti@gmail.com ELTE
More informationSome experiences in adding a new language to SSQSA architecture a part of SSQSA front-end. Jozef Kolek, Gordana Rakić, Zoran Budimac
Some experiences in adding a new language to SSQSA architecture a part of SSQSA front-end Jozef Kolek, Gordana Rakić, Zoran Budimac 1 Content 1. Introduction 2. Adding a Language 3. Some of the SMIILE
More informationAbstract Syntax Trees
Abstract Syntax Trees COMS W4115 Prof. Stephen A. Edwards Fall 2007 Columbia University Department of Computer Science Parsing and Syntax Trees Parsing decides if the program is part of the language. Not
More informationImplementing Actions
Abstract Syntax Trees COMS W4115 Prof. Stephen A. Edwards Fall 2006 Columbia University Department of Computer Science In a top-down parser, actions are executed during the matching routines. can appear
More informationImplementing languages on the Erlang VM
Robert Virding Principle Language Expert at Erlang Solutions Ltd. Erlang Solutions Ltd. Implementing languages on the Erlang VM 19992012 Erlang Solutions Ltd. What languages? Basic Tools 3 case studies
More informationLFE - a lisp on the Erlang VM
Robert Virding Principle Language Expert at Erlang Solutions Ltd. LFE - a lisp on the Erlang VM What LFE isn t It isn t an implementation of Scheme It isn t an implementation of Common Lisp It isn t an
More informationSyntax-Directed Translation. Lecture 14
Syntax-Directed Translation Lecture 14 (adapted from slides by R. Bodik) 9/27/2006 Prof. Hilfinger, Lecture 14 1 Motivation: parser as a translator syntax-directed translation stream of tokens parser ASTs,
More informationParsing. Zhenjiang Hu. May 31, June 7, June 14, All Right Reserved. National Institute of Informatics
National Institute of Informatics May 31, June 7, June 14, 2010 All Right Reserved. Outline I 1 Parser Type 2 Monad Parser Monad 3 Derived Primitives 4 5 6 Outline Parser Type 1 Parser Type 2 3 4 5 6 What
More informationIntroduction to Parsing. Lecture 8
Introduction to Parsing Lecture 8 Adapted from slides by G. Necula Outline Limitations of regular languages Parser overview Context-free grammars (CFG s) Derivations Languages and Automata Formal languages
More informationRYERSON POLYTECHNIC UNIVERSITY DEPARTMENT OF MATH, PHYSICS, AND COMPUTER SCIENCE CPS 710 FINAL EXAM FALL 96 INSTRUCTIONS
RYERSON POLYTECHNIC UNIVERSITY DEPARTMENT OF MATH, PHYSICS, AND COMPUTER SCIENCE CPS 710 FINAL EXAM FALL 96 STUDENT ID: INSTRUCTIONS Please write your student ID on this page. Do not write it or your name
More informationASTs, Objective CAML, and Ocamlyacc
ASTs, Objective CAML, and Ocamlyacc Stephen A. Edwards Columbia University Fall 2012 Parsing and Syntax Trees Parsing decides if the program is part of the language. Not that useful: we want more than
More informationA programming language requires two major definitions A simple one pass compiler
A programming language requires two major definitions A simple one pass compiler [Syntax: what the language looks like A context-free grammar written in BNF (Backus-Naur Form) usually suffices. [Semantics:
More informationPrinciples of Programming Languages COMP251: Syntax and Grammars
Principles of Programming Languages COMP251: Syntax and Grammars Prof. Dekai Wu Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong, China Fall 2007
More informationErlang. Types, Abstract Form & Core. Salvador Tamarit Muñoz. Universitat Politècnica de València
Erlang Types, Abstract Form & Core Salvador Tamarit Muñoz Universitat Politècnica de València Contents 1 Introduction Motivation 2 Concurrent Erlang 3 Further reading Introduction Introduction Erlang is
More informationCOSE312: Compilers. Lecture 1 Overview of Compilers
COSE312: Compilers Lecture 1 Overview of Compilers Hakjoo Oh 2017 Spring Hakjoo Oh COSE312 2017 Spring, Lecture 1 March 7, 2017 1 / 15 What is Compiler? Software systems that translate a program written
More informationRacket: Macros. Advanced Functional Programming. Jean-Noël Monette. November 2013
Racket: Macros Advanced Functional Programming Jean-Noël Monette November 2013 1 Today Macros pattern-based macros Hygiene Syntax objects and general macros Examples 2 Macros (According to the Racket Guide...)
More informationIntroduction to Compiler Design
Introduction to Compiler Design Lecture 1 Chapters 1 and 2 Robb T. Koether Hampden-Sydney College Wed, Jan 14, 2015 Robb T. Koether (Hampden-Sydney College) Introduction to Compiler Design Wed, Jan 14,
More informationTwo-dimensional Extensibility of SSQSA Framework
5 Two-dimensional Extensibility of SSQSA Framework JOZEF KOLEK, GORDANA RAKIĆ AND MILOŠ SAVIĆ, University of Novi Sad The motivation to improve systematic application of software analysis tools by improving
More informationAn Introduction to Functions
Chapter 4 An Introduction to Functions Through the agency of with, we have added identifiers and the ability to name expressions to the language. Much of the time, though, simply being able to name an
More informationCOMPILER CONSTRUCTION LAB 2 THE SYMBOL TABLE. Tutorial 2 LABS. PHASES OF A COMPILER Source Program. Lab 2 Symbol table
COMPILER CONSTRUCTION Lab 2 Symbol table LABS Lab 3 LR parsing and abstract syntax tree construction using ''bison' Lab 4 Semantic analysis (type checking) PHASES OF A COMPILER Source Program Lab 2 Symtab
More informationMetaprogramming and symbolic execution for detecting runtime errors in Erlang programs
Metaprogramming and symbolic execution for detecting runtime errors in Erlang programs Emanuele De Angelis 1, Fabio Fioravanti 1, Adrián Palacios 2, Alberto Pettorossi 3 and Maurizio Proietti 4 1 University
More informationDomain-specific languages with custom operators
Proceedings of the 9 th International Conference on Applied Informatics Eger, Hungary, January 29 February 1, 2014. Vol. 2. pp. 263 271 doi: 10.14794/ICAI.9.2014.2.263 Domain-specific languages with custom
More informationProblems in Systematic Application of Software Metrics and Possible Solution
Problems in Systematic Application of Software Metrics and Possible Solution Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty of Sciences, University of Novi Sad, Trg Dositeja
More informationIntroduction to Lexical Analysis
Introduction to Lexical Analysis Outline Informal sketch of lexical analysis Identifies tokens in input string Issues in lexical analysis Lookahead Ambiguities Specifying lexical analyzers (lexers) Regular
More informationA Language for Specifying Type Contracts in Erlang and its Interaction with Success Typings
A Language for Specifying Type Contracts in Erlang and its Interaction with Success Typings Miguel Jiménez 1, Tobias Lindahl 1,2, Konstantinos Sagonas 3,1 1 Department of Information Technology, Uppsala
More informationDEPARTMENT OF COMPUTER SCIENCE
Department of Computer Science 1 DEPARTMENT OF COMPUTER SCIENCE Office in Computer Science Building, Room 279 (970) 491-5792 cs.colostate.edu (http://www.cs.colostate.edu) Professor L. Darrell Whitley,
More informationStructure of a compiler. More detailed overview of compiler front end. Today we ll take a quick look at typical parts of a compiler.
More detailed overview of compiler front end Structure of a compiler Today we ll take a quick look at typical parts of a compiler. This is to give a feeling for the overall structure. source program lexical
More informationTransformations of Erlang programs based on complexity metrics
Transformations of Erlang programs based on complexity metrics Thesises of the Doctoral Dissertation 2013 Roland Király http://aries.ektf.hu/~serial/kiralyroland/ kiraly.roland@aries.ektf.hu Advisor: Dr.
More informationSPIN s Promela to Java Compiler, with help from Stratego
SPIN s Promela to Java Compiler, with help from Stratego Master s Thesis Edwin Vielvoije SPIN s Promela to Java Compiler, with help from Stratego THESIS submitted in partial fulfillment of the requirements
More informationCMPT 379 Compilers. Parse trees
CMPT 379 Compilers Anoop Sarkar http://www.cs.sfu.ca/~anoop 10/25/07 1 Parse trees Given an input program, we convert the text into a parse tree Moving to the backend of the compiler: we will produce intermediate
More informationa. It will output It s NOT Rover b. Class Main should be changed to the following (bold characters show the changes)
May 2015 Computing Advanced Paper 1 Question 1 a. It will output It s NOT Rover b. Class Main should be changed to the following (bold characters show the changes) public class Main public static void
More informationOutline. Limitations of regular languages. Introduction to Parsing. Parser overview. Context-free grammars (CFG s)
Outline Limitations of regular languages Introduction to Parsing Parser overview Lecture 8 Adapted from slides by G. Necula Context-free grammars (CFG s) Derivations Languages and Automata Formal languages
More informationRuntime Checking for Program Verification Systems
Runtime Checking for Program Verification Systems Karen Zee, Viktor Kuncak, and Martin Rinard MIT CSAIL Tuesday, March 13, 2007 Workshop on Runtime Verification 1 Background Jahob program verification
More informationGenerating Code from Event-B Using an Intermediate Specification Notation
Rodin User and Developer Workshop Generating Code from Event-B Using an Intermediate Specification Notation Andy Edmunds - ae02@ecs.soton.ac.uk Michael Butler - mjb@ecs.soton.ac.uk Between Abstract Development
More informationCSE450 Translation of Programming Languages. Lecture 4: Syntax Analysis
CSE450 Translation of Programming Languages Lecture 4: Syntax Analysis http://xkcd.com/859 Structure of a Today! Compiler Source Language Lexical Analyzer Syntax Analyzer Semantic Analyzer Int. Code Generator
More informationCSCI312 Principles of Programming Languages!
CSCI312 Principles of Programming Languages!! Chapter 3 Regular Expression and Lexer Xu Liu Recap! Copyright 2006 The McGraw-Hill Companies, Inc. Clite: Lexical Syntax! Input: a stream of characters from
More informationStructure of Abstract Syntax trees for Colored Nets in PNML
Structure of Abstract Syntax trees for Colored Nets in PNML F. Kordon & L. Petrucci Fabrice.Kordon@lip6.fr Laure.Petrucci@lipn.univ-paris13.fr version 0.2 (draft) June 26, 2004 Abstract Formalising the
More informationAutomatic Mining of Functionally Equivalent Code Fragments via Random Testing. Lingxiao Jiang and Zhendong Su
Automatic Mining of Functionally Equivalent Code Fragments via Random Testing Lingxiao Jiang and Zhendong Su Cloning in Software Development How New Software Product Cloning in Software Development Search
More informationChapter 3. Interactive Software Development Assistants Logic-based Software Representation. Logic-based Software Analysis
Advanced Logic Programming Summer semester 2012 R O O T S Chapter 3. Logic-based Analysis Interactive Development Assistants Logic-based Representation Logic-based Analysis Logic-based Transformation Motivation
More informationThe PCAT Programming Language Reference Manual
The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language
More informationTowards Programs Logic Based Representation Driven by Grammar and Conforming to a Metamodel
Towards Programs Logic Based Representation Driven by Grammar and Conforming to a Metamodel Ciprian-Bogdan Chirila and Călin Jebelean University Politehnica of Timişoara, Romania Faculty of Automation
More informationCSc 453. Compilers and Systems Software. 13 : Intermediate Code I. Department of Computer Science University of Arizona
CSc 453 Compilers and Systems Software 13 : Intermediate Code I Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2009 Christian Collberg Introduction Compiler Phases
More informationIntroduction to Lexical Analysis
Introduction to Lexical Analysis Outline Informal sketch of lexical analysis Identifies tokens in input string Issues in lexical analysis Lookahead Ambiguities Specifying lexers Regular expressions Examples
More informationCS152 Programming Language Paradigms Prof. Tom Austin, Fall Syntax & Semantics, and Language Design Criteria
CS152 Programming Language Paradigms Prof. Tom Austin, Fall 2014 Syntax & Semantics, and Language Design Criteria Lab 1 solution (in class) Formally defining a language When we define a language, we need
More informationCS Lecture 2. The Front End. Lecture 2 Lexical Analysis
CS 1622 Lecture 2 Lexical Analysis CS 1622 Lecture 2 1 Lecture 2 Review of last lecture and finish up overview The first compiler phase: lexical analysis Reading: Chapter 2 in text (by 1/18) CS 1622 Lecture
More informationQuery Processing and Optimization using Compiler Tools
Query Processing and Optimization using Compiler Tools Caetano Sauer csauer@cs.uni-kl.de Karsten Schmidt kschmidt@cs.uni-kl.de Theo Härder haerder@cs.uni-kl.de ABSTRACT We propose a rule-based approach
More informationStarting the System & Basic Erlang Exercises
Starting the System & Basic Erlang Exercises These exercises will help you get accustomed with the Erlang development and run time environments. Once you have set up the Erlang mode for emacs, you will
More informationPrototype Environment for Refactoring Clean Programs
Prototype Environment for Refactoring Clean Programs Extended abstract Rozália Szabó-Nacsa, Péter Diviánszky, Zoltán Horváth Department of Software Technology and Methodology, Eötvös Loránd University,
More information10/4/18. Lexical and Syntactic Analysis. Lexical and Syntax Analysis. Tokenizing Source. Scanner. Reasons to Separate Lexical and Syntactic Analysis
Lexical and Syntactic Analysis Lexical and Syntax Analysis In Text: Chapter 4 Two steps to discover the syntactic structure of a program Lexical analysis (Scanner): to read the input characters and output
More information22c:111 Programming Language Concepts. Fall Syntax III
22c:111 Programming Language Concepts Fall 2008 Syntax III Copyright 2007-08, The McGraw-Hill Company and Cesare Tinelli. These notes were originally developed by Allen Tucker, Robert Noonan and modified
More informationProf. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan
Language Processing Systems Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Semantic Analysis Compiler Architecture Front End Back End Source language Scanner (lexical analysis)
More informationMeta programming on the proof level
Acta Univ. Sapientiae, Informatica, 1, 1 (2009) 15 34 Meta programming on the proof level Gergely Dévai Eötvös Loránd University, Faculty of Informatics, Department of Programming Languages and Compilers
More informationLanguages and Compilers
Principles of Software Engineering and Operational Systems Languages and Compilers SDAGE: Level I 2012-13 4. Lexical Analysis (Scanning) Dr Valery Adzhiev vadzhiev@bournemouth.ac.uk Office: TA-121 For
More informationCOMPILER CONSTRUCTION Seminar 02 TDDB44
COMPILER CONSTRUCTION Seminar 02 TDDB44 Martin Sjölund (martin.sjolund@liu.se) Adrian Horga (adrian.horga@liu.se) Department of Computer and Information Science Linköping University LABS Lab 3 LR parsing
More informationProgrammiersprachen (Programming Languages)
2016-05-13 Preface Programmiersprachen (Programming Languages) coordinates: lecturer: web: usable for: requirements: No. 185.208, VU, 3 ECTS Franz Puntigam http://www.complang.tuwien.ac.at/franz/ps.html
More informationDetaching and Reconstructing the Documentary Structure of Source Code
Chapter 1 Detaching and Reconstructing the Documentary Structure of Source Code Péter Diviánszky, Attila Góbi, Dániel Leskó, Mónika Mészáros, 1 Gábor Páli 2 Category: Research 3 Abstract: Comments and
More informationCST-402(T): Language Processors
CST-402(T): Language Processors Course Outcomes: On successful completion of the course, students will be able to: 1. Exhibit role of various phases of compilation, with understanding of types of grammars
More informationRecap: Functions as first-class values
Recap: Functions as first-class values Arguments, return values, bindings What are the benefits? Parameterized, similar functions (e.g. Testers) Creating, (Returning) Functions Iterator, Accumul, Reuse
More informationSung-Eun Choi and Steve Deitz Cray Inc.
Sung-Eun Choi and Steve Deitz Cray Inc. Fast prototyping writeln( hello, world ); Production-grade module HelloWorld { def main() { writeln( hello, world ); } } Chapel: Language Basics 2 Syntax Basics
More information10/5/17. Lexical and Syntactic Analysis. Lexical and Syntax Analysis. Tokenizing Source. Scanner. Reasons to Separate Lexical and Syntax Analysis
Lexical and Syntactic Analysis Lexical and Syntax Analysis In Text: Chapter 4 Two steps to discover the syntactic structure of a program Lexical analysis (Scanner): to read the input characters and output
More informationIntroduction to Model Checking
Introduction to Model Checking René Thiemann Institute of Computer Science University of Innsbruck WS 2007/2008 RT (ICS @ UIBK) week 4 1/23 Outline Promela - Syntax and Intuitive Meaning Promela - Formal
More informationWritten Presentation: JoCaml, a Language for Concurrent Distributed and Mobile Programming
Written Presentation: JoCaml, a Language for Concurrent Distributed and Mobile Programming Nicolas Bettenburg 1 Universitaet des Saarlandes, D-66041 Saarbruecken, nicbet@studcs.uni-sb.de Abstract. As traditional
More informationSyntax and Grammars 1 / 21
Syntax and Grammars 1 / 21 Outline What is a language? Abstract syntax and grammars Abstract syntax vs. concrete syntax Encoding grammars as Haskell data types What is a language? 2 / 21 What is a language?
More informationThe Abstract Behavioral Specification Language
The Abstract Behavioral Specification Language Frank S. de Boer CWI frb@cwi.nl Scientific Meeting CWI, November 29, 2013 How It All Started? Simula (Ole Johan Dahl, Turing award 2001) Credo FP6 project
More informationBenefits of implementing a query language in purely functional style
Benefits of implementing a query language in purely functional style Artúr Poór, István Bozó, Tamás Kozsik, Gábor Páli, Melinda Tóth poor_a@inf.elte.hu, bozo_i@inf.elte.hu, kto@inf.elte.hu, pgj@inf.elte.hu,
More informationApplication: Programming Language Semantics
Chapter 8 Application: Programming Language Semantics Prof. Dr. K. Madlener: Specification and Verification in Higher Order Logic 527 Introduction to Programming Language Semantics Programming Language
More informationCS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)
CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square) Introduction This semester, through a project split into 3 phases, we are going
More informationThe Substitution Model
The Substitution Model Prof. Clarkson Fall 2017 Today s music: Substitute by The Who Review Previously in 3110: simple interpreter for expression language abstract syntax tree (AST) evaluation based on
More informationCode Structure Visualization
TECHNISCHE UNIVERSITEIT EINDHOVEN Department of Mathematics and Computer Science MASTER S THESIS Code Structure Visualization by G.L.P.M. Lommerse Supervisor: Dr. Ir. A.C. Telea (TUE) Eindhoven, August
More informationParsing II Top-down parsing. Comp 412
COMP 412 FALL 2018 Parsing II Top-down parsing Comp 412 source code IR Front End Optimizer Back End IR target code Copyright 2018, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled
More informationFormal Languages and Compilers Lecture I: Introduction to Compilers
Formal Languages and Compilers Lecture I: Introduction to Compilers Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/ artale/
More informationStatic Analysis of VHDL
Dipl.-Inform. Marc Schlickling schlickling@cs.uni-sb.de Compiler Design Lab Prof. Dr. Reinhard Wilhelm Universität des Saarlandes 2 / 30 Content Data flow analysis Control Flow Representation Language
More informationIntroduction to Parsing. Lecture 5
Introduction to Parsing Lecture 5 1 Outline Regular languages revisited Parser overview Context-free grammars (CFG s) Derivations Ambiguity 2 Languages and Automata Formal languages are very important
More informationWeb Services Annotation and Reasoning
Web Services Annotation and Reasoning Mikhail Roshchin, PhD Student Peter Graubmann, Evelyn Pfeuffer CT SE 2, Siemens AG roshchin@gmail.com Motivation _ Current Problems Software Applications work with
More informationContext-Free Grammar. Concepts Introduced in Chapter 2. Parse Trees. Example Grammar and Derivation
Concepts Introduced in Chapter 2 A more detailed overview of the compilation process. Parsing Scanning Semantic Analysis Syntax-Directed Translation Intermediate Code Generation Context-Free Grammar A
More informationPreparing for the ACW Languages & Compilers
Preparing for the ACW 08348 Languages & Compilers Introductory Lab There is an Introductory Lab Just involves copying the lab task See separate Lab slides Language Roadmaps Convenient way of showing syntax
More informationFunctional Programming
Functional Programming CS331 Chapter 14 Functional Programming Original functional language is LISP LISt Processing The list is the fundamental data structure Developed by John McCarthy in the 60 s Used
More informationChapter 3. Describing Syntax and Semantics ISBN
Chapter 3 Describing Syntax and Semantics ISBN 0-321-49362-1 Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Copyright 2009 Addison-Wesley. All
More informationChapter 10: Compiler I: Syntax Analysis
Elements of Computing Systems, Nisan & Schocken, MIT Press, 2005 Chapter 10: Compiler I: Syntax Analysis www.idc.ac.il/tecs Usage and Copyright Notice: Copyright 2005 Noam Nisan and Shimon Schocken This
More informationCS321 Languages and Compiler Design I. Winter 2012 Lecture 1
CS321 Languages and Compiler Design I Winter 2012 Lecture 1 1 COURSE GOALS Improve understanding of languages and machines. Learn practicalities of translation. Learn anatomy of programming languages.
More informationFunctional Programming. Pure Functional Languages
Functional Programming Pure functional PLs S-expressions cons, car, cdr Defining functions read-eval-print loop of Lisp interpreter Examples of recursive functions Shallow, deep Equality testing 1 Pure
More informationRefactoring Erlang Programs
Refactoring Erlang Programs Huiqing Li, Simon Thompson University of Kent, UK László Lövei, Zoltán Horváth, Tamás Kozsik, Anikó Víg, Tamás Nagy Eötvös Loránd University, Hungary Abstract We describe refactoring
More informationDecaf Language Reference
Decaf Language Reference Mike Lam, James Madison University Fall 2016 1 Introduction Decaf is an imperative language similar to Java or C, but is greatly simplified compared to those languages. It will
More informationTopic 3: Syntax Analysis I
Topic 3: Syntax Analysis I Compiler Design Prof. Hanjun Kim CoreLab (Compiler Research Lab) POSTECH 1 Back-End Front-End The Front End Source Program Lexical Analysis Syntax Analysis Semantic Analysis
More informationA Gentle Introduction to Program Analysis
A Gentle Introduction to Program Analysis Işıl Dillig University of Texas, Austin January 21, 2014 Programming Languages Mentoring Workshop 1 / 24 What is Program Analysis? Very broad topic, but generally
More informationIndex. caps method, 180 Character(s) base, 161 classes
A Abjads, 160 Abstract syntax tree (AST), 3 with action objects, 141 143 definition, 135 Action method for integers converts, 172 173 S-Expressions, 171 Action objects ASTs, 141 142 defined, 137.made attribute,
More information