logo资料库

CPN ML CPN 建模语言.pdf

第1页 / 共15页
第2页 / 共15页
第3页 / 共15页
第4页 / 共15页
第5页 / 共15页
第6页 / 共15页
第7页 / 共15页
第8页 / 共15页
资料共15页,剩余部分请下载后查看
Design/CPN Overview of CPN ML Syntax Version 3.0 University o f Aarhus Computer Science Department Ny Munkegade, Bldg. 540 DK-8000 Aarhus C, Denmark Tel: +45 89 42 31 88 Fax: +45 89 42 32 55 © 1996 University of Aarhus
© 1996 University of Aarhus Computer Science Department Ny Munkegade, Bldg. 540 DK-8000 Aarhus C, Denmark Tel: +45 89 42 31 88 Fax: +45 89 42 32 55 e-mail: designCPN-support@daimi.aau.dk Authors: Søren Christensen and Torben Bisgaard Haagh. Design/CPN is a trademark of Meta Software Corporation. Macintosh is a registered trademark of Apple Computer, Inc. ML-2 Design/CPN – Overview of CPN ML Syntax
Design/CPN Overview of CPN ML Syntax Version 3.0 Table of Contents Chapter 1 Colour Sets Relational Operations............................................................................................5 Simple Colour Sets................................................................................................5 Compound Colour Sets.........................................................................................7 Declare Clause.......................................................................................................9 Chapter 2 Multi-sets Operations on Multi-Sets.....................................................................................11 Timed Simulations................................................................................................12 Chapter 3 Miscellaneous Identifiers................................................................................................................13 Values.....................................................................................................................13 Variables................................................................................................................13 Reference Variables.............................................................................................14 Functions................................................................................................................14 Design/CPN – Overview of CPN ML Syntax ML-3
Chapter 1 Colour Sets Colour sets can be declared in many different ways, but they are all in some way constructed from basic SML-types. This means that the colour sets automatically inherit a number standard functions and operations. Relational Operations The equality operators = and <> are defined for all colour sets, while <, >, <= and >= only are defined for integers, reals and strings. To test the order of the elements in other colour sets, use the lt function (see section on declare clause). Simple Colour Sets Unit colour sets color name = unit [with new_unit]; Order: trivial Boolean colour sets color name = bool [with (new_false, new_true)]; Order: Operations: false before true not b b1 andalso b2 b1 orelse b2 negation of the boolean value b boolean conjunction, and boolean disjunction, inclusive or Design/CPN – Overview of CPN ML Syntax ML-5
Overview of CPN ML Syntax Integer colour sets color name = int [with int-expi..int-expj]; Order: Operations: ~i i1 + i2 i1 - i2 i1 * i2 i1 div i2 i1 mod i2 abs i min (i1, i2) max (i1, i2) usual ordering of numbers negation of the intger value i addition subtraction multiplication division, quotient modulus, remainder absolute value of i minimum of i1 and i2 maximum of i1 and i2 Real colour sets color name = real [with real-expi..real-expj ]; Order: Operations: ~r r1 + r2 r1 - r2 r1 * r2 r1 / r2 sqrt r abs r min (r1, r2) max (r1, r2) floor r ln r exp r sin r cos r tan r arctan r real i usual ordering of numbers negation of the real value r addition subtraction multiplication division square root absolute value minimum of r1 and r2 maximum of r1 and r2 convert real to integer natural logarithm exponential sine cosine tangent arc tangent convert integer i to real value ML-6 Design/CPN – Overview of CPN ML Syntax
Colour Sets String colour sets color name = string [with string-expi..string-expj [and int-expm i n..int-expmax]]; lexicographic (with the ascii ordering) Order: Operations: s1 ^ s2 size s substring (s,i,l) extract a substring of length l starting at concatenate the strings s1 and s2 number of characters in s explode s implode l ord s ordof (s,i) chr i position i in s, first position is 0 convert string s to list of one character strings convert list l of strings to a string ordinal value of first character of s ordinal value of the i'th character first position is 0 single-character string from ordinal value i Enumerated colour sets color name = with id1 | id2 | . . . | idn; Order: as in the declaration Index colour sets color name = index id with int-expi..int-expj; usual ordering on the indexes Order: Compound Colour Sets Product colour sets color name = product name1 * name2 * … * namen; Order: Values: Operations: #i _ lexicographic (with respect to ordering of base colour sets) (v1, v2,…, vn) extract the ith element of tuple (does not work for the Edinburgh ML compiler) omit component in tuple (not allowed in CPN inscriptions) Design/CPN – Overview of CPN ML Syntax ML-7
Overview of CPN ML Syntax Record colour sets color name = record id1 : name1 * id2 : name2 * … * idn: namen; Order: Values: Operations: #idi … lexicographic (with respect to ordering of base colour sets) {id1 = v1, id2 = v2,…, idn = vn} extract the idi-element from the record omit field in record (not allowed in CPN inscriptions) List colour sets color name = list name0 [with int-expm i n..int-expmax]; Order: Values: Operations: nil e::l l1 ^^ l2 hd l tl l length l nth (l, n) nthtail (l, n) rev l exists p l null l map f l app f l fold f l z lexicographic (with respect to ordering of base colour set) [v1, v2,…, vn] empty list (same as []) prepend element e in head of list l concatenate the two lists l1 and l2 head, the first element of the list tail, list with exception of first element length of list nth element in list remove first n elements of list reverse list true if p is true for some element in list true if list is empty use function f on each value of list and returns a list with all the results use function f on each value of list and returns () returns f(l1, f(l2,…f(ln, z) …)) where l = [l1, l2,…, ln] Union colour sets color name = union id1 [: name1 ] + id2[: name2] + . . . Order: Values: + idn[: namen]; first after selectors, then after ordering of each base colour set idi(v) ML-8 Design/CPN – Overview of CPN ML Syntax
分享到:
收藏