ModIM - A Modelica Frontend With Static Analysis
|
|
|
- Alice Logan
- 10 years ago
- Views:
Transcription
1 ModIM - A Modelica Frontend With Static Analysis Christoph Höger Technische Universität Berlin ( [email protected] ) Abstract: We present ModIM, a Modelica front-end library written in Java. ModIM is designed to not only support the development of Compilers/Interpreters but also tools that are currently underrepresented in the Modelica ecosystem. This includes (but is not limited to) advanced editors, documentation generators and model checkers. For that purpose ModIM offers a static environment generation and type inference algorithm. Both algorithms are adaptions of standard techniques to the characteristics of Modelica. Environment generation is rather complex, but specified intensely. The type system is straight forward, but lacks a formal specification and thus is an interpretation of the Modelica specifications intents. Additionally it is extended to also cover some unique features of Modelica. This extension consists of a formalization of the four kinds of variabilities and the introduction of a new type for unknowns. Keywords: Modelica, Abstract Syntax, Frontend, Java, Library, Static Analysis 1. INTRODUCTION Modelica (mod, 2010) is a modeling language for physical systems. The need for complementary tools and software grows, as the language becomes more and more successful in research as well as industrial application. Usually such software does not implement the complete model-compilesimulate workflow (which is already covered quite well). Instead, it focuses on a single task in or next to this workflow (e.g. version control (Harman, 2011)). Since Modelica is currently usually interpreted just prior to the generation of simulation code, there is little to no available support for the development of such tools. Especially there is currently no library that one could use for static analysis of Modelica models. model example Real x,y; discrete Boolean b(start = false); equation when time > 1 then b = true; end when; x = time; y = if b then y else x; end example; Listing 1. Modeling error Listing 1 motivates the need for such static analysis. It contains an equation which is obviously singular (for time > 1). This kind of error appears at simulation time and is only reported as a simulation failure in current tools. Usually the model s author is not the same person as its end user (the one who actually does a simulation). A developer thus has no means to ship a model which is checked to be free from such errors. A static analysis of the partial model (before distribution) can prevent those cases. In this paper we present ModIM ( Modelica Intermediate Model ), a Java library which is designed for static analysis of Modelica models. ModIM contains a complete abstract syntax for Modelica, a lexer/parser implementation and a static type checker. The rest of the paper is organized as follows: First, we will present the design (and reasons for the design-decisions) behind ModIM. Second, we will give a short overview of how to use it. Afterwards we will present the formal concepts behind the type checker that is implemented in ModIM. Finally, the paper will close with an outlook to future development. 2. LIBRARY DESIGN The design of ModIM is lead by several decisions. We will discuss the most significant of them. The implementation of ModIM in Java is the first important design choice. This has little to do with Java s superiority over any other language (assuming such an advantage would even exist), but with some pragmatic thoughts: First of all, Java (and thus ModIM) is platform independent free software. Second, Java is broadly adopted in industry and science. And last but not least Java provides a healthy ecosystem of libraries, build systems etc. which simplifies the development process of ModIM itself. The second design decision for ModIM is the absence of Object orientation. More precisely: ModIM is not designed for extensibility. In an object-oriented design, functions (or methods) are tightly coupled with data structures (or objects). This design allows to extend a library with a new data structure by simply implementing all those (abstract)
2 methods once for the new object. On the same time this makes it notoriously hard to implement a new function for all data structures. Especially it makes it impossible to implement two new functions independently in parallel (since both would need to change every object definition). Because these limitations would affect the usability of ModIM as a front-end library, we decided that the data structures should be fixed. Operations on those data structures are implemented following the visitor-pattern (Gamma et al., 1994). Thus the implementation of a new operation is straight-forward (in turn, the addition of a new data structure becomes rather complex). This decision was also supported by the fact that Modelica itself is fixed by its specification. Thus a new data structure should only be necessary for a new language version. The next design decision is concerned with the content of ModIM s data structures: The core of ModIM is a typeannotated abstract syntax tree. Persistently annotating the tree with its types instead of throwing away that information distinguishes ModIM from a usual compiler front-end. It becomes comfortable to develop tools like editors, documentation generators and so on(while writing a compiler or interpreter is still possible). Currently ModIM does not allow for further generic attributes. This limitation is not fixed but was introduced for pragmatic reasons (generic attributes would require an implementation that has some performance penalty. With types being the only attributes for now that penalty seemed unreasonable.). Finally, the most important design decision (and the very reason for ModIM s existence) is the equal treatment of any possible use case. ModIM as a general purpose library does not make any assumption about how it should be used. It may be used in an interpreter, compiler, embedded in an integrated development environment or wherever it seems useful. 3. LIBRARY USAGE The data structures in ModIM are separated from the algorithms, as already discussed above. A third part of the library is concerned with the input processing: This module handles the lexing, parsing and abstract syntax generation. The parser is currently generated with ANTLR, but other implementations are possible (older versions of ModIM used PaGe, an experimental incremental LALR parser generator (Höger, 2009)). Naturally, ModIM is implemented on top of several other libraries. All those dependencies are (as ModIM) free software and thus provide no additional barriers for users of the library. (Technically the dependency management is handled by ModIM s build system of choice, maven.) public static void main(string[] args) { final List<String> arglist = Arrays.asList(args); final TypeChecker typechecker = new TypeChecker( LOAD_AST, arglist.sublist(1, arglist.size())); } final IStoredDefinitionNode root = LOAD_AST.apply(new File(args[0])); /* apply type check */ root.accept(typechecker); /* report type errors */ for (Entry err : typechecker. gettypeerrors(). entryset()) { report(err.getkey(), err.getvalue()); } Listing 2. ModIM example Listing 2 shows how a simple static analysis tool might be implemented by using ModIM: Given a LOAD AST delegate, which invokes the parser from the input module, and the type-checker, a tool can load and check any Modelica source files and report all type errors it encountered. Even though the listing does not show any elaborate algorithm, it demonstrates two important aspects of ModIM clients: The input source is exchangeable. In general, a good client should not depend on any particular parsing method, since it might be used in a different context. The algorithms (the type-checker in this case) are implemented as visitors and can be invoked on any data structure. To do so, the data structure (in our case the StoredDefinitionNode) is asked to accept the visitor. It is important to note that ModIM s data structures are twofold: On the one side there is the abstract syntax. This data structure is kept as close as possible to the specified Modelica grammar. This part of the library is unlikely to change and should be relatively easy to understand for tool developers. On the other side there is the type system. Modelica does not contain an abstract definition of its types. Therefore all data-structures here are interpretations of the specification. Furthermore, the type system itself is subject to ongoing research. The design and intentions of this part of the library will be discussed below. 4. TYPE CHECK When studying the type system of Modelica it becomes apparent that there is actually no definition of type-safety in the specification. This is of course due to the lack of a well-defined evaluation strategy for expressions. For any formal type system this means, that correctness cannot be proved. So instead of aiming at correctness, our focus in this paper lies more on a type system as means of communication. In the following we will write type system rules as inference rules: Γ e 1 : R e 2 : R Γ e 1 + e 2 : R In such a rule Γ, as usual, describes a type environment, containing declarations. e i describes an expression of the language, which (due to the size of the Modelica grammar)
3 will not further be specified in this paper. Concrete syntax elements are written in fixed size font. A statement Γ e : τ reads: Under the type environment Γ, e has type τ. If all premises of the rule are fulfilled, the conclusion also holds. Although we do not aim at full formalization or type safety proofs, partially formalizing the type system in such a way serves a purpose: The type checker in ModIM is implemented as an inference engine that applies such a rule to every expression. Therefore inference rules are a concise way to describe the algorithm. 4.1 Types Types in Modelica have been subject to research (Broman et al., 2006) from a model composition perspective. In contrast, ModIM s type-checker aims at the expression level. Consequently in the abstract syntax tree the only elements that can be annotated with a type are expressions. As most languages, Modelica contains of a finite set of built-in types and several type expressions that allow users to define their own types. The built-in types of Modelica are Boolean, Real, String and Integer. We write those types as B = {S,R,I,B}. The user-derived types are given by the following grammar: UserType ::= Rec Arr Tup Fun Inst Rec ::= { (Name :T)+ } Tup ::= (T+ ) Arr ::= T [Expr+ ] Fun ::= T T Inst ::= Name This grammar contains the complex types a user can create: records, (multi-dimensional) arrays, functions (we left out named- and default-parameters here for brevity) and model instances (only a reference to a model in ModIM). Tuples are not explicitly mentioned in the specification but implicitly contained, since Modelica allows for functions with multiple return values (even if only in a syntactically restricted way). The grammar shows that Modelica s type system does not contain parametric polymorphism in expressions, since there are no type variables a user could define. Though the influence of redeclarations (see below) on function definitions still needs to be evaluated. Variability Abbrev. can change constant c never parameter p at simulation start discrete d during events continuous t with every time step Fig. 1. Variabilities in Modelica In contrast to most declarative programming languages, Modelica describes time-variant systems. This means that expressions may evaluate to different values at different points in time. This fact is well known from most imperative languages, where basic types are annotated with an additional flag (often called the constness), which indicates, weather they might change or not. Modelica contains four such kinds of variability (Figure 1). WecallthesetofvariabilitiesV = {c,p,d,t}andintroduce an ordering c < p < d < t. Now we can provide the concrete syntax of types as they are implemented by ModIM: Type ::= <V T > T ::= B UserType type T var Type Here the set T describes, what we will call simple types. Simple types are extended with a variability to form a type. The elements after user-defined and built-in types need some explanation: The first one, type T is simply a concession to a more technical problem: ModIM s type inference is implemented as a visitor and annotates every expression with its type. This means, that the names of classes, functions etc. also need to have a type. The solution chosen is to give them a second-order type. Although Modelica does not actually require higher-order types, this allows to use simpler datastructures and even to define some type rules in a simpler way (e.g. the direct access of constant elements from class names). The second addition is a little bit more complicated: The semantic domain of Modelica is a system of differential and algebraic equations. Such a system naturally contains unknowns,whichneedtobesolvedatagivenpointintime. Although syntactically similar to parameters and constants, those unknowns are semantically different: They can only be evaluated at simulation time. Operationally, they behave much more like functions (ranging over time), than numerical values. Before we can show why this second addition was necessary, we need to introduce some relations over the now complete set of types. First of all, we introduce the common subtype relation between simple types: T T We are not going into details on the topic of subtyping, since for all elements of T well known subtyping rules exist (see e.g. Pierce (2002) for a detailed discussion of the topic). Those rules are based on the substitution principle, meaning that any subtype can safely be used instead of a supertype at any place. We will give just one example for the classical subtyping rule on functions: γ α β δ α β γ δ This rule shows how the substitution principle leads to a contravariant relationship between the arguments of two functions. Likewise we can define on records, tuples etc. Subtyping on arrays was chosen to be covariant in ModIM (since Modelica does not contain typecasts, write access to an array does not change the type of the stored content).
4 As usual, is a reflexive, transitive and antisymmetric relation. So by adding and to T as least and greatest elements, becomes a lattice. Since we have already introduced an ordering < on the variabilities (and thus ), we can lift the subtype relation of simple types to a subtype relation on types: <: Type Type t 1 t 2 v 1 v 2 v 1,t 1 <: v 2,t 2 It is easy to see that <: also is a lattice with c, and t, being the least and greatest elements. This allows us to use the supremum and infimum in our type rules. 4.2 The Variable Type As already mentioned, unknowns can only be evaluated at simulation time. One could argue that, because the same property holds for every expression with continuous variability, such an extension is redundant from a evaluation perspective. Yet, from the static analysis perspective, this does not suffice. Consider a generic rule for if-expressions: Γ e 1 : v 1,B Γ e 2 : τ 1 Γ e 3 : τ 2 v 2,t = τ 1 τ 2 t Γ if e 1 then e 2 else e 3 : max(v 1,v 2 ),t This rule defines, that an if-expression yields the least common supertype of the then- and the else-branch. There is nothing wrong with that kind of type judgments, when it comes to expression evaluation. Indeed, when computing i.e. the residual, this is exactly the kind of type check that prevents us from adding strings to real-values, but allows to mix integers with floating point numbers. Yet, without the variable type one important piece of information is lost: In the example model in listing 1, the if- expression would have the type t,r (i.e. it is a continuous-time expression yielding real values). Yet in fact it yields different unknowns depending on the value of the discrete-time variable b. Thus, the system is structurally dynamic (see, e.g. Zimmer (2010) for a detailed discussion of this topic), as can be seen with the variable type: Γ b : d,b Γ x : c,var t,r Γ y : c,var t,r Γ if b then y else x : d,var t,r As mentioned earlier, ModIM is agnostic over its clients. While some tool might be able to handle such dynamics (or even not be interested in it at all), others might rely on this information. Therefore ModIM will annotate such expressions accordingly. As a side effect, several built-in operators (e.g. reinit()), or the left-hand-sides of whenequations can now be checked easily. To allow the evaluation of unknowns at simulation time, we simply need to add a special subtyping rule: v 3 = max(v 1,v 2 ) v 1,var v 2,t <: v 3,t This basically means that an unknown can always be evaluated and yields a value which has at least the variability of the unknown s content. Additionally, if a model contains records for the declaration of unknowns, a special lookup rule is applied(a similar rule exists for array-access of variables): Γ e : v 1,var v 2,t 1 t 1 {x : t 2 } Γ e.x : v 1,var v 2,t Environment Creation The extension of the type-environment is usually defined alongside with the type rules. In academic languages, where the only source for environment extension consists of function abstraction or let-expressions, this might suffice. For ModIM, we will discuss the environment separately from the type analysis for several reasons: First, Modelica has no formally defined type system. Instead several rules are given in plain English in the specification. Here we see a clear distinction between types for expressions and objects (which are due to the structural kind of Modelica s type system defined by the lookup rules). Thus by creating the environment by a separate algorithm our implementation stays closer to the specification in at least an organizational sense. Second, ModIM is, as already mentioned, not designed to support only the usual check and forget design of interpreters and compilers. Instead, we want to allow for interactive work with the abstract syntax tree. This is much easier when the type environment can be created on demand for a certain tree-node. Thus the environment becomes an annotation of a given tree (Currently this annotation needs to be stored separately, because there is yet no generic attribute mechanism in ModIM. But this is just a technical issue.). Finally, the distinction between lookup and type errors allows better error messages: Some type errors tend to be rather large and hard to read. (e.g. the fact that the least common supertype of several else-if expressions is is relatively hard to understand.) On the other hand, name errors (like double definition) are rather easy to report. As usual Modelica s type environment consists of element declarations in the form x :Type. The basic lookup is specified by a simple type rule: Γ(x) = τ Γ x : τ While this a standard technique, the actual implementation of Γ and its calculation is far more interesting. In Modelica, several sources contribute to the type environment of a class. These are: The lexical scope. As most languages, Modelica supports the access to names upwards the abstract syntax tree. Thus, the environment of the parent node is
5 the originofaclass ownenvironment.notallofthem can be accessed legally (e.g. unknowns), but this is a technical detail. The external environment. This source contains elements that are defined outside of the current compilation unit. It is only technically different from the lexical scope. Local type declarations. If a class contains another class, it can be accessed by its name. Thus the first component of the local environment is the set of local classes, functions, etc. Imports. Modelica allows to import other classes (or their components) into the current scope. Inherited environments. All components of every super-class are part of the sub-class environment. Again, not all of the elements are legally accessible (e.g. protected elements). Local components. Naturally, the locally defined components are part of the local environment. With the exception of the lexical scope, all of those sources are disjoint (i.e. they do not yield the same name twice, otherwise this is an error). So for the lookup it does not matter in which order they are processed. The lexical scope needs to be the last source of a name, since shadowing of names is allowed. Mathematically, lookup is a partial function from names to types: Γ : Name Type. This function can easily be implemented as a map. In ModIM we choose to use a list of maps, since we wanted to reduce the overhead of e.g. copying a class local environment into the inherited environments of another class. protected final LinkedList<Map<String, Type>> getidentifiermap(final IClassNode node) { final ClassScope scope = ccm.getscopefor(node); final LinkedList<Map<String, Type>> completescope = Lists. newlinkedlist(); final Map<String, Type> externalsmap = getexternalenvironment( node, scope); completescope. add( externalsmap); lookup.add(externalsmap); final Map<String, Type> localtypesmap = getlocaltypeenvironment( node, scope); lookup. add( localtypesmap); completescope. add( localtypesmap); final LinkedList<Map<String, Type>> importmap = createimports( node, scope); lookup.addall(importmap); completescope. addall( importmap); final List<Map<String, Type>> extmap = getextensionenvironment( node, scope); lookup.addall(extmap); completescope. addall( extmap); handleshortextends( node, scope); final Map<String, Type> childmap = } getcomponentenvironment( node, scope); completescope. add( childmap); lookup.add(childmap); scope. completescope = completescope; return scope. completescope; Listing 3. Generating the environment Listing 3 shows the key method in static lookup (stripped from caching, error detection etc. for brevity): The method getidentifiermap() returns the union of a class environment sources, implemented as a linked list of partial environment maps. This list contains all (including protected members and types) identifiers that are valid in the scope of the given class. While doing so, a the locally used environment lookup is extended. The already mentioned lookup function is implemented by searching through all maps in the list in reverse order. This guarantees lexical shadowing of names. The order, in which the type environment is created, is important: While the order of lookup does not matter for the disjoint sources, the order of creation does. An importstatement, for instance, contains a name on its left-handside. This name needs to be looked up (i.e. searched in the local environment). It may (according to the language specification) not depend on local or inherited, but on external or surrounding declarations so those must already exist in the environment. The same kind of dependencies can be applied to extendstatements and local components. Thus the side effect of extending the environment (the lookup.add(...) invocations) needs to be applied exactly in the given order. 4.4 Type Rules As already mentioned, the system of simple types in Modelica is, well, simple. Yet we will present two interesting rules as they are implemented in ModIM: First, consider the rather important derivative operator der() in Modelica. Obviously, if applied to a variable of the continuous type, the result is again a continuous real expression (one might even argue, if the result shall be a variable again). This is implemented by the following rule: Γ e :,var t,r Γ der(e) : t,r But what about parameters and constants? The specification states: For Real parameters and constants the result is a zero scalar or array of the same size as the variable. Thus, the value of the operator is known at compile time (0) and the resulting type is a constant: Γ e : v,r v < d Γ der(e) : c,i The other interesting rule is concerned with the delay() operator. The specification demands:
6 The arguments, i.e., expr, delaytime and delaymax, need to be subtypes of Real. Delay- Max needs to be additionally a parameter expression. [...] If delaymax is not supplied in the argument list, delaytime need to be a parameter expression. The corresponding rules could be implemented as: Γ e 1 : τ 1 Γ e 2 : τ 2 Γ e 3 : τ 3 τ 1 <: v,r τ 2 <:,R τ 3 <: p,r Γ delay(e 1,e 2,e 3 ) : τ 1 Γ e 1 : τ 1 τ 1 <: v,r Γ e 2 : τ 2 τ 2 <: p,r Γ delay(e 1,e 2 ) : τ 1 5. FUTURE WORK ModIM currently supports large parts of the Modelica Standard Library (version 3.2). Out of 182 files, around 170 already pass the type-check. Most of the failing test cases are due to a currently missing implementation of function partial evaluation through Modelica s modifications. Yet some are failing simply because of bugs. Besides those obvious reasons, there are several other points of interest for future development: 5.1 Redeclarations Redeclarations are Modelica s way of bounded parametric polymorphism. By lexically introducing a component with a redeclare flag, a model author indicates that he or she wishes to use the locally defined type instead of the inherited type ofthe samename.this alsoappliestousage ofthe inherited type (soall complextypes that containthe redeclared type are changed as well). While ModIM currently already supports redeclarations, it does so in an inefficient manner. Currently, all types in all inherited environments are subject to the application of redeclarations. This is, of course, costly. A future version of ModIM might make usage of type-variables to make this search unnecessary. 5.2 Use Cases Development of what later should become ModIM originally started as a compiler front-end. This use-case largely influenced the need for static analysis and independence from the operational-style specification. Yet, since ModIM shall support any use-case equally, there is the need for some (demonstrating) clients. Current plans contain an interpreter(implementing flattening on top of ModIM) and a documentation generator. Future development might also see a semantic style-checker (like CheckStyle (Burn, 2001) or FindBugs (Hovemeyer and Pugh, 2004)). 5.3 Adding Relations Currently ModIM is only equipped with the relations it needs for static analysis. Further versions could be extended in that regard: With the implemented type-checker we can make type judgments for the problematic equation in Listing 1. Note that x itself is of constant type, since whenever we denote that expression it yields the same variable: Γ x : c,v[ t,r ] Now a compiler author might be interested in the question, which variables an expression can always yield a solution for. Therefore we can introduce the relation. This relation can easily use the existing type-annotations: Γ e : c,var τ Γ e {e} The author then just needs to implement the interesting cases: Γ e 1 V 1 Γ e 2 V 2 Γ if then e 1 else e 2 V 1 V 2 Such a relation can be easily implemented in ModIM with only very few lines of code. While this relation might not be general enough to find its way into the semanticsof Modelica, it is still useful and could be partof some (automatically checked) style guide. Unfortunately, the author must currently develop an implementation for every syntactic element (of which Modelica contains a large amount). ModIM should support the implementation of default rules and combinators for such relations. With that infrastructure, an author could develop, document and combine new relations easily. REFERENCES (2010). Modelica - a unified object-oriented language for physical systems modeling. URL modelica.org/documents/modelicaspec32.pdf. Broman, D., Fritzson, P., and Furic, S. (2006). Types in the Modelica Language. In Proceedings of the Fifth International Modelica Conference. Vienna, Austria. Burn, O. (2001). Checkstyle. Computer Program. URL Gamma, E., Helm, R., and Johnson, R.E. (1994). Design Patterns. Elements of Reusable Object-Oriented Software. Addison-Wesley Longman, Amsterdam, 1st ed., reprint. edition. Harman, P. (2011). Effective version control of modelica models. In Proceedings of the 8th International Modelica Conference, March 20th-22nd, Technical Univeristy, Dresden, Germany, Linköping Electronic Conference Proceedings, Linköping University Electronic Press, Linköpings universitet. Höger, C. (2009). Generation of incremental parsers for modern ides. In J. Knoop and A. Prantl (eds.), KPS 09: 15. Kolloquium Programmiersprachen und Grandlagen der Programmierung. Hovemeyer, D. and Pugh, W. (2004). Finding bugs is easy. In ACM SIGPLAN Notices, ACM Press. Pierce, B.C. (2002). Types and Programming Languages. MIT Press. Zimmer, D. (2010). Equation-based Modeling of Variablestructure Systems. Ph.D. thesis, ETH Zürich.
Chapter 7: Functional Programming Languages
Chapter 7: Functional Programming Languages Aarne Ranta Slides for the book Implementing Programming Languages. An Introduction to Compilers and Interpreters, College Publications, 2012. Fun: a language
Comp 411 Principles of Programming Languages Lecture 34 Semantics of OO Languages. Corky Cartwright Swarat Chaudhuri November 30, 20111
Comp 411 Principles of Programming Languages Lecture 34 Semantics of OO Languages Corky Cartwright Swarat Chaudhuri November 30, 20111 Overview I In OO languages, data values (except for designated non-oo
Introducing Formal Methods. Software Engineering and Formal Methods
Introducing Formal Methods Formal Methods for Software Specification and Analysis: An Overview 1 Software Engineering and Formal Methods Every Software engineering methodology is based on a recommended
Checking Access to Protected Members in the Java Virtual Machine
Checking Access to Protected Members in the Java Virtual Machine Alessandro Coglio Kestrel Institute 3260 Hillview Avenue, Palo Alto, CA 94304, USA Ph. +1-650-493-6871 Fax +1-650-424-1807 http://www.kestrel.edu/
Concepts and terminology in the Simula Programming Language
Concepts and terminology in the Simula Programming Language An introduction for new readers of Simula literature Stein Krogdahl Department of Informatics University of Oslo, Norway April 2010 Introduction
Semantic Analysis: Types and Type Checking
Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors
CSCI 3136 Principles of Programming Languages
CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University Winter 2013 CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University
Parsing Technology and its role in Legacy Modernization. A Metaware White Paper
Parsing Technology and its role in Legacy Modernization A Metaware White Paper 1 INTRODUCTION In the two last decades there has been an explosion of interest in software tools that can automate key tasks
Integrating Formal Models into the Programming Languages Course
Integrating Formal Models into the Programming Languages Course Allen B. Tucker Robert E. Noonan Computer Science Department Computer Science Department Bowdoin College College of William and Mary Brunswick,
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 7 Scanner Parser Project Wednesday, September 7 DUE: Wednesday, September 21 This
[Refer Slide Time: 05:10]
Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture
CS 2112 Spring 2014. 0 Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions
CS 2112 Spring 2014 Assignment 3 Data Structures and Web Filtering Due: March 4, 2014 11:59 PM Implementing spam blacklists and web filters requires matching candidate domain names and URLs very rapidly
Textual Modeling Languages
Textual Modeling Languages Slides 4-31 and 38-40 of this lecture are reused from the Model Engineering course at TU Vienna with the kind permission of Prof. Gerti Kappel (head of the Business Informatics
An Exception Monitoring System for Java
An Exception Monitoring System for Java Heejung Ohe and Byeong-Mo Chang Department of Computer Science, Sookmyung Women s University, Seoul 140-742, Korea {lutino, [email protected] Abstract. Exception
Write Barrier Removal by Static Analysis
Write Barrier Removal by Static Analysis Karen Zee and Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Cambridge, MA 02139 {kkz, [email protected] ABSTRACT We present
Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.
Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java
Design Patterns in Parsing
Abstract Axel T. Schreiner Department of Computer Science Rochester Institute of Technology 102 Lomb Memorial Drive Rochester NY 14623-5608 USA [email protected] Design Patterns in Parsing James E. Heliotis
Lecture 9. Semantic Analysis Scoping and Symbol Table
Lecture 9. Semantic Analysis Scoping and Symbol Table Wei Le 2015.10 Outline Semantic analysis Scoping The Role of Symbol Table Implementing a Symbol Table Semantic Analysis Parser builds abstract syntax
Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding
Compiling Object Oriented Languages What is an Object-Oriented Programming Language? Last time Dynamic compilation Today Introduction to compiling object oriented languages What are the issues? Objects
Variable Base Interface
Chapter 6 Variable Base Interface 6.1 Introduction Finite element codes has been changed a lot during the evolution of the Finite Element Method, In its early times, finite element applications were developed
Improving Interoperability in Mechatronic Product Developement. Dr. Alain Biahmou, Dr. Arnulf Fröhlich, Dr. Josip Stjepandic
International Conference on Product Lifecycle Management 1 Improving Interoperability in Mechatronic Product Developement Dr. Alain Biahmou, Dr. Arnulf Fröhlich, Dr. Josip Stjepandic PROSTEP AG Dolivostr.
Moving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
New Generation of Software Development
New Generation of Software Development Terry Hon University of British Columbia 201-2366 Main Mall Vancouver B.C. V6T 1Z4 [email protected] ABSTRACT In this paper, I present a picture of what software development
Towards a Benchmark Suite for Modelica Compilers: Large Models
Towards a Benchmark Suite for Modelica Compilers: Large Models Jens Frenkel +, Christian Schubert +, Günter Kunze +, Peter Fritzson *, Martin Sjölund *, Adrian Pop* + Dresden University of Technology,
The C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
The Clean programming language. Group 25, Jingui Li, Daren Tuzi
The Clean programming language Group 25, Jingui Li, Daren Tuzi The Clean programming language Overview The Clean programming language first appeared in 1987 and is still being further developed. It was
Type Classes with Functional Dependencies
Appears in Proceedings of the 9th European Symposium on Programming, ESOP 2000, Berlin, Germany, March 2000, Springer-Verlag LNCS 1782. Type Classes with Functional Dependencies Mark P. Jones Department
Analyse et Conception Formelle. Lesson 5. Crash Course on Scala
Analyse et Conception Formelle Lesson 5 Crash Course on Scala T. Genet (ISTIC/IRISA) ACF-5 1 / 36 Bibliography Simply Scala. Online tutorial: http://www.simply.com/fr http://www.simply.com/ Programming
Syntax Check of Embedded SQL in C++ with Proto
Proceedings of the 8 th International Conference on Applied Informatics Eger, Hungary, January 27 30, 2010. Vol. 2. pp. 383 390. Syntax Check of Embedded SQL in C++ with Proto Zalán Szűgyi, Zoltán Porkoláb
Object-Oriented Software Specification in Programming Language Design and Implementation
Object-Oriented Software Specification in Programming Language Design and Implementation Barrett R. Bryant and Viswanathan Vaidyanathan Department of Computer and Information Sciences University of Alabama
Formal Engineering for Industrial Software Development
Shaoying Liu Formal Engineering for Industrial Software Development Using the SOFL Method With 90 Figures and 30 Tables Springer Contents Introduction 1 1.1 Software Life Cycle... 2 1.2 The Problem 4 1.3
Introduction to Object-Oriented Programming
Introduction to Object-Oriented Programming Programs and Methods Christopher Simpkins [email protected] CS 1331 (Georgia Tech) Programs and Methods 1 / 8 The Anatomy of a Java Program It is customary
Glossary of Object Oriented Terms
Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction
Functional Programming. Functional Programming Languages. Chapter 14. Introduction
Functional Programming Languages Chapter 14 Introduction Functional programming paradigm History Features and concepts Examples: Lisp ML 1 2 Functional Programming Functional Programming Languages The
Data Abstraction and Hierarchy
Data Abstraction and Hierarchy * This research was supported by the NEC Professorship of Software Science and Engineering. Barbara Liskov Affiliation: MIT Laboratory for Computer Science Cambridge, MA,
Semester Review. CSC 301, Fall 2015
Semester Review CSC 301, Fall 2015 Programming Language Classes There are many different programming language classes, but four classes or paradigms stand out:! Imperative Languages! assignment and iteration!
Overview. Elements of Programming Languages. Advanced constructs. Motivating inner class example
Overview Elements of Programming Languages Lecture 12: Object-oriented functional programming James Cheney University of Edinburgh November 6, 2015 We ve now covered: basics of functional and imperative
Module 10. Coding and Testing. Version 2 CSE IIT, Kharagpur
Module 10 Coding and Testing Lesson 23 Code Review Specific Instructional Objectives At the end of this lesson the student would be able to: Identify the necessity of coding standards. Differentiate between
Software Testing. Definition: Testing is a process of executing a program with data, with the sole intention of finding errors in the program.
Software Testing Definition: Testing is a process of executing a program with data, with the sole intention of finding errors in the program. Testing can only reveal the presence of errors and not the
I. INTRODUCTION. International Journal of Computer Science Trends and Technology (IJCST) Volume 3 Issue 2, Mar-Apr 2015
RESEARCH ARTICLE An Exception Monitoring Using Java Jyoti Kumari, Sanjula Singh, Ankur Saxena Amity University Sector 125 Noida Uttar Pradesh India OPEN ACCESS ABSTRACT Many programmers do not check for
Automatic Test Data Generation for TTCN-3 using CTE
Automatic Test Data Generation for TTCN-3 using CTE Zhen Ru Dai, Peter H. Deussen, Maik Busch, Laurette Pianta Lacmene, Titus Ngwangwen FraunhoferInstitute for Open Communication Systems (FOKUS) Kaiserin-Augusta-Allee
A Thread Monitoring System for Multithreaded Java Programs
A Thread Monitoring System for Multithreaded Java Programs Sewon Moon and Byeong-Mo Chang Department of Computer Science Sookmyung Women s University, Seoul 140-742, Korea [email protected], [email protected]
The Rules 1. One level of indentation per method 2. Don t use the ELSE keyword 3. Wrap all primitives and Strings
Object Calisthenics 9 steps to better software design today, by Jeff Bay http://www.xpteam.com/jeff/writings/objectcalisthenics.rtf http://www.pragprog.com/titles/twa/thoughtworks-anthology We ve all seen
El Dorado Union High School District Educational Services
El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.
Taming Wildcards in Java s Type System
Taming Wildcards in Java s Type System Ross Tate University of California, San Diego [email protected] Alan Leung University of California, San Diego [email protected] Sorin Lerner University of California,
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Scanner-Parser Project Thursday, Feb 7 DUE: Wednesday, Feb 20, 9:00 pm This project
REST Client Pattern. [Draft] Bhim P. Upadhyaya ABSTRACT
REST Client Pattern [Draft] Bhim P. Upadhyaya EqualInformation Chicago, USA [email protected] ABSTRACT Service oriented architecture (SOA) is a common architectural practice in large enterprises. There
Sources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
Dinopolis Java Coding Convention
Dinopolis Java Coding Convention Revision : 1.1 January 11, 2001 Abstract Please note that this version of the Coding convention is very much based on IICM s internal Dino coding convention that was used
Meta Model Based Integration of Role-Based and Discretionary Access Control Using Path Expressions
Meta Model Based Integration of Role-Based and Discretionary Access Control Using Path Expressions Kathrin Lehmann, Florian Matthes Chair for Software Engineering for Business Information Systems Technische
Using Object And Object-Oriented Technologies for XML-native Database Systems
Using Object And Object-Oriented Technologies for XML-native Database Systems David Toth and Michal Valenta David Toth and Michal Valenta Dept. of Computer Science and Engineering Dept. FEE, of Computer
C Compiler Targeting the Java Virtual Machine
C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the
An Eclipse Plug-In for Visualizing Java Code Dependencies on Relational Databases
An Eclipse Plug-In for Visualizing Java Code Dependencies on Relational Databases Paul L. Bergstein, Priyanka Gariba, Vaibhavi Pisolkar, and Sheetal Subbanwad Dept. of Computer and Information Science,
An Automatic Reversible Transformation from Composite to Visitor in Java
An Automatic Reversible Transformation from Composite to Visitor in Java Akram To cite this version: Akram. An Automatic Reversible Transformation from Composite to Visitor in Java. CIEL 2012, P. Collet,
Functional Programming
FP 2005 1.1 3 Functional Programming WOLFRAM KAHL [email protected] Department of Computing and Software McMaster University FP 2005 1.2 4 What Kinds of Programming Languages are There? Imperative telling
Programming Languages
Programming Languages Qing Yi Course web site: www.cs.utsa.edu/~qingyi/cs3723 cs3723 1 A little about myself Qing Yi Ph.D. Rice University, USA. Assistant Professor, Department of Computer Science Office:
Efficient database auditing
Topicus Fincare Efficient database auditing And entity reversion Dennis Windhouwer Supervised by: Pim van den Broek, Jasper Laagland and Johan te Winkel 9 April 2014 SUMMARY Topicus wants their current
A First Set of Design Patterns for Algorithm Animation
Fifth Program Visualization Workshop 119 A First Set of Design Patterns for Algorithm Animation Guido Rößling CS Department, TU Darmstadt Hochschulstr. 10 64289 Darmstadt, Germany [email protected] Abstract
Towards a Framework for Generating Tests to Satisfy Complex Code Coverage in Java Pathfinder
Towards a Framework for Generating Tests to Satisfy Complex Code Coverage in Java Pathfinder Matt Department of Computer Science and Engineering University of Minnesota [email protected] Abstract We present
Redesign and Enhancement of the Katja System
Redesign and Enhancement of the Katja System Internal Report No. 354/06 Patrick Michel October 30, 2006 Contents 1 Introduction 5 2 Redesigning the Katja System 5 2.1 Architecture and Control Flow..................
Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation
Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science updated 03/08/2012 Unit 1: JKarel 8 weeks http://www.fcps.edu/is/pos/documents/hs/compsci.htm
Computing Concepts with Java Essentials
2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann
Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007
Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 The Java Type System By now, you have seen a fair amount of Java. Time to study in more depth the foundations of the language,
The Phases of an Object-Oriented Application
The Phases of an Object-Oriented Application Reprinted from the Feb 1992 issue of The Smalltalk Report Vol. 1, No. 5 By: Rebecca J. Wirfs-Brock There is never enough time to get it absolutely, perfectly
A Multi-layered Domain-specific Language for Stencil Computations
A Multi-layered Domain-specific Language for Stencil Computations Christian Schmitt, Frank Hannig, Jürgen Teich Hardware/Software Co-Design, University of Erlangen-Nuremberg Workshop ExaStencils 2014,
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Semantic Analysis Project Tuesday, Feb 16 DUE: Monday, Mar 1 Extend your compiler
Software Engineering Techniques
Software Engineering Techniques Low level design issues for programming-in-the-large. Software Quality Design by contract Pre- and post conditions Class invariants Ten do Ten do nots Another type of summary
Object Oriented Databases (OODBs) Relational and OO data models. Advantages and Disadvantages of OO as compared with relational
Object Oriented Databases (OODBs) Relational and OO data models. Advantages and Disadvantages of OO as compared with relational databases. 1 A Database of Students and Modules Student Student Number {PK}
Java Application Developer Certificate Program Competencies
Java Application Developer Certificate Program Competencies After completing the following units, you will be able to: Basic Programming Logic Explain the steps involved in the program development cycle
1 Introduction. 2 An Interpreter. 2.1 Handling Source Code
1 Introduction The purpose of this assignment is to write an interpreter for a small subset of the Lisp programming language. The interpreter should be able to perform simple arithmetic and comparisons
Objects for lexical analysis
Rochester Institute of Technology RIT Scholar Works Articles 2002 Objects for lexical analysis Bernd Kuhl Axel-Tobias Schreiner Follow this and additional works at: http://scholarworks.rit.edu/article
Software quality improvement via pattern matching
Software quality improvement via pattern matching Radu Kopetz and Pierre-Etienne Moreau INRIA & LORIA {Radu.Kopetz, [email protected] Abstract. Nested if-then-else statements is the most common
Object Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction
YouTrack MPS case study
YouTrack MPS case study A case study of JetBrains YouTrack use of MPS Valeria Adrianova, Maxim Mazin, Václav Pech What is YouTrack YouTrack is an innovative, web-based, keyboard-centric issue and project
Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition
Java 6 'th edition Concepts INTERNATIONAL STUDENT VERSION CONTENTS PREFACE vii SPECIAL FEATURES xxviii chapter i INTRODUCTION 1 1.1 What Is Programming? 2 J.2 The Anatomy of a Computer 3 1.3 Translating
1 External Model Access
1 External Model Access Function List The EMA package contains the following functions. Ema_Init() on page MFA-1-110 Ema_Model_Attr_Add() on page MFA-1-114 Ema_Model_Attr_Get() on page MFA-1-115 Ema_Model_Attr_Nth()
Object Instance Profiling
Object Instance Profiling Lubomír Bulej 1,2, Lukáš Marek 1, Petr Tůma 1 Technical report No. 2009/7, November 2009 Version 1.0, November 2009 1 Distributed Systems Research Group, Department of Software
A Static Analyzer for Large Safety-Critical Software. Considered Programs and Semantics. Automatic Program Verification by Abstract Interpretation
PLDI 03 A Static Analyzer for Large Safety-Critical Software B. Blanchet, P. Cousot, R. Cousot, J. Feret L. Mauborgne, A. Miné, D. Monniaux,. Rival CNRS École normale supérieure École polytechnique Paris
AP Computer Science Java Subset
APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall
CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages. Nicki Dell Spring 2014
CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages Nicki Dell Spring 2014 What is a Programming Language? A set of symbols and associated tools that translate (if necessary) collections
Getting Started with the Internet Communications Engine
Getting Started with the Internet Communications Engine David Vriezen April 7, 2014 Contents 1 Introduction 2 2 About Ice 2 2.1 Proxies................................. 2 3 Setting Up ICE 2 4 Slices 2
Integration of Application Business Logic and Business Rules with DSL and AOP
Integration of Application Business Logic and Business Rules with DSL and AOP Bogumiła Hnatkowska and Krzysztof Kasprzyk Wroclaw University of Technology, Wyb. Wyspianskiego 27 50-370 Wroclaw, Poland [email protected]
GenericServ, a Generic Server for Web Application Development
EurAsia-ICT 2002, Shiraz-Iran, 29-31 Oct. GenericServ, a Generic Server for Web Application Development Samar TAWBI PHD student [email protected] Bilal CHEBARO Assistant professor [email protected] Abstract
Proceedings of the 6th Educators Symposium: Software Modeling in Education at MODELS 2010 (EduSymp 2010)
Electronic Communications of the EASST Volume 34 (2010) Proceedings of the 6th Educators Symposium: Software Modeling in Education at MODELS 2010 (EduSymp 2010) Position Paper: m2n A Tool for Translating
Regression Verification: Status Report
Regression Verification: Status Report Presentation by Dennis Felsing within the Projektgruppe Formale Methoden der Softwareentwicklung 2013-12-11 1/22 Introduction How to prevent regressions in software
Mining a Change-Based Software Repository
Mining a Change-Based Software Repository Romain Robbes Faculty of Informatics University of Lugano, Switzerland 1 Introduction The nature of information found in software repositories determines what
Object Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction
Generalizing Overloading for C++2000
Generalizing Overloading for C++2000 Bjarne Stroustrup AT&T Labs, Florham Park, NJ, USA Abstract This paper outlines the proposal for generalizing the overloading rules for Standard C++ that is expected
Quality Ensuring Development of Software Processes
Quality Ensuring Development of Software Processes ALEXANDER FÖRSTER,GREGOR ENGELS Department of Computer Science University of Paderborn D-33095 Paderborn, Germany {alfo engels}@upb.de ABSTRACT: Software
SQL INJECTION ATTACKS By Zelinski Radu, Technical University of Moldova
SQL INJECTION ATTACKS By Zelinski Radu, Technical University of Moldova Where someone is building a Web application, often he need to use databases to store information, or to manage user accounts. And
Tutorial on Writing Modular Programs in Scala
Tutorial on Writing Modular Programs in Scala Martin Odersky and Gilles Dubochet 13 September 2006 Tutorial on Writing Modular Programs in Scala Martin Odersky and Gilles Dubochet 1 of 45 Welcome to the
Programming Languages CIS 443
Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception
Embedded Software Development with MPS
Embedded Software Development with MPS Markus Voelter independent/itemis The Limitations of C and Modeling Tools Embedded software is usually implemented in C. The language is relatively close to the hardware,
The Needle Programming Language
The Needle Programming Language The Needle Programming Language 1 What is Needle? Needle is an object-oriented functional programming language with a multimethod-based OO system, and a static type system
