This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: BOBJ: A Quickstart for Software Engineers Lutz Hamel Dept. of Computer Science and Statistics University of Rhode Island Kingston, RI 02881 hamel@cs.uri.edu DRAFT 12/7/03 Getting Started BOBJ is a specification language based on equational logic and algebra. Infor mally, in equational logic axioms are expressed as equations with algebras as models and term rewriting as operational semantics. Due to the efficient oper ational semantics, BOBJ specifications are executable; once you have specified your system, you can actually run the specification and see if it behaves correctly. Furthermore, due to the fact that BOBJ is rigorously based on mathematical foundations you can use BOBJ to prove things about your specifications. Specifications The basic specification unit in BOBJ is called an object. objects themselves consist of type definitions (called sorts in BOBJ lingo) and operator name defi nitions. Behavior is defined for the operators via a set of equations. The equa tions themselves can also contain variables. The following could be considered a typical specification: obj NUMBERS is sort Nat . op 0 : > Nat . op s : Nat > Nat . op _+_ : Nat Nat > Nat . var M : Nat . var N : Nat . eq M + s(N) = s(M + N) . eq M + 0 = M . endo This specification defines the object NUMBERS . Within this object we define the sort Nat as well as the three operator symbols: , s , and + . The notation 1 for the operator symbol declaration follows very closely standard mathematical practice: op 0 :> Nat defines a constant of type Nat , op s : Nat > Nat defines a unary function symbol that takes a value in domain Nat to its codomain Nat , and op + : Nat Nat > Nat defines an infix binary operator. BOBJ admits mixfix operator declarations, that is, we can define prefix, infix, or post fix operator symbols. When no special action is taken during the definition of a function symbol it defaults to being a prefix function symbol. You can use underscores to tell the BOBJ parser how the operator is to appear in the target expressions. Following the operator declarations we have the variable declara tions. Finally, we assign some behavior to the + operator with the equations appearing at the end of the object. The first equation states that computing the successor of N and then adding that to M is the same as first adding M and N and then computing the successor of the sum. The second equation states that adding zero to a value will not change the value. Running BOBJ Before you can load a specification into BOBJ your have to start BOBJ, usually by typing the keyword bobj at the Unix command prompt. The system will respond: [lutz]% java jar bobj.jar \/ Welcome to BOBJ  /\ BOBJ version 2.0 built: 2000 Jun 20 Tue 20:18:45 Copyright 1988,1989,1991 SRI International 2002 Nov 21 Thu 7:33:22 BOBJ> At this point you are ready to load specification files into BOBJ. Assume that the above specification is called numbers.bob, then in order to load this intothe above specification is called numbers....
View Full
Document
 Spring '11
 Staff
 Computer Science

Click to edit the document details