delft@fwi.uva.nl (Andre van Delft) (11/08/89)
ANNOUNCEMENT About a month ago Vincent van der Laan announced Scriptic, an event-driven and parallel extension to C, Pascal and Modula-2. Here is some more information. I also post a sample Macintosh application in Scriptic on comp.lang.misc. NOTE: Scriptic is *not* Just Another Programming Language. Its features are based on a neat theory, and it therefore makes programming much easier. Scriptic answers many questions discussed on Internet newsgroups about event-driven and parallel programming. Scriptic is here to stay. BACKGROUND Various application areas such as user interfaces, simulations and language parsers require considerable programming efforts in conventional languages. Several languages and packages have been therefore been developed, such as Occam, Prolog and Yacc, but their success has been limited. They are 'too different', in style and in expressiveness. Moreover, language features for parallelism and choice require a precise and simple theoretical foundation. I claim that Scriptic is the answer, or close to the answer. Scriptic is a simple extension to C, Pascal and Modula-2; you can still apply traditional code in your Scriptic programs; data structures remain completely the same. You do not have to learn an entirely new language. SCRIPTS The new feature in Scriptic is the "script", which is like a function or a procedure. A script may have parameters and local variables; its body is a "script expression", built with operators (in increasing priority): | choice (only one of its operands may happen) + choice (more than one operands may happen) % breaking: the left-hand operand is halted when the right-hand starts / like % with a minor difference ; sequence , parallelism : guards (like if-statements and in case-tags in the base languages) Operator priorities can be overruled with parentheses, as in mathematical expressions. Basic operands in script expressions are: * Code fragments in the base language placed between braces, such as {printf("%d\n,i")} and {i=0}. * A "script call" (like a procedure or function call) Actual script parameters can be of three kinds: input, output or matching. Matching parameters can be specified instead of output parameters if the output value should match a given value. Output parameters are suffixed by a question mark, matching parameters by an exclamation mark. So Key( c ?) can mean that a key is pressed on the keyboard, and that its value is stored in the variable c Key('x'!) then means that the key 'x' is pressed on the keyboard * .. (a pair of periods), denoting an iteration (alternative, breaking, sequential or parallel), and simultaneously denoting an exit point. Scriptic iterations are *much* more powerful than any iteration construct in C, Pascal or Modula-2. Several other language features: * optional behavior is enclosed in brackets; [..] is an optional exit point * communication between processes (synchroneous; two actions "melt" into one) * attributes for code fragments: - eventtype : this attribute cooperates with event managers such as the one in the Macintosh programmers toolbox - duration : the 'time' needed for the code fragment, useful for simulations - pass : denotes the pass of the nearest encompassing iteration (0 during the first pass; incremented in each subsequent pass) - priority : essentially the same notion as many operating systems have - preference: looks like priority, but merely determines try-order of alternatives The following example (in the C-version) repeatedly prompts for input and accepts 'h' from the keyboard, which it responds with "hello ", until finally 'g' is pressed; then "goodbye" is printed: prompt = {printf("'h' for hello, or 'g' for goodbye ==> ")} hello = {printf("hello " )} goodbye = {printf("goodbye ")} main = (prompt; [..]; Key('h'!); hello); Key('g'!); goodbye APPLICATION AREAS Scriptic targets at the areas that are now covered by C, Pascal, Modula-2, Ada, simulation packages, and Prolog and its parallel derivatives. Scriptic has appeared very useful for: * User interfaces a la Macintosh, see the sample program posted to comp.lang.misc. * Simulations, e.g., manufacturing systems and communication protocols. * Language processors. We developed a preprocessor that translates Scriptic into C, Pascal or Modula-2; it has been bootstrapped (written in Scriptic itself), since Scriptic is more flexible and usable than traditional parser generators. For instance, with guards you easily specify the difference between the syntaxes of Pascal and Modula-2. * Software requirements and specifications. Even without Scriptic programmers package, the formalism can be useful: it makes software requirements and specifications concise and clear. Scriptic is ideal for describing language syntaxes. PARALLELISM Scriptic supports parallel *programming*, not parallel *processing*; No special hardware required; Scriptic currently only runs on normal computers. Many software applications are elegantly programmed with parallel constructs,such as process simulations and even language processors. THEORY Scriptic achieves what many researchers have been waiting for, because it has been founded on a pure and sound theory: Process Algebra. Both Scriptic and Process Algebra are Dutch. For further reading: J.A.Bergstra,J.W.Klop, Process algebra for synchronous communication, Information & Control 60 (1/3), pp. 77-121, 1985 J.A.Bergstra,J.W.Klop, Algebra of communicating processes, Proceedings CWI Symposium on Mathematics&Computer Science (J.W. de Bakker, M. Hazewinkel, J.K. Lenstra, editors), pp 61-94, North-Holland, 1986 FUTURE DEVELOPMENTS The expressiveness of Scriptic may well be enhanced within a year in one or more of the following directions: * Logic Programming; Scriptic already offers most of the expressiveness of Prolog and its parallel derivatives (Scriptic has no special support for list manipulation); but Scriptic may become even *TRUE* Logic Programming ... * Object-Oriented Programming; it seems easy to allow scripts as class features in C++; I also would like very much to make an Eiffel based version. * Parallel Processing: parallel Scriptic implementations (Convex, Pyramid, Transputers, ...) seem possible; what parallel computer vendors are interested? CONCLUSION Scriptic has been developed by one person, not by a committee. The language could not have been defined without its implementation. Design criteria were: * expressiveness * lexical clarity, syntactic simplicity * combination with base languages * conformance to Process Algebra * implementation efficiency, elegance, simplicity and portability The Scriptic programmers package: available fromJDelftware Technology from end-1989; contains bootstrapped preprocessor and run-time support. Prices (until 1/1/1989): $349 on Macintosh, PC; $1449 on Sun. Scriptic, Occam, Ada, Apple, Macintosh, Sun, IBM, Convex, Pyramid, Transputer and Delftware are trademarks +--========--, | Delftware Technology | | DelftWare) ) | Gentsestraat 165 | Even Bertrand Meyer's opinion +--========--` | 2587 HP Den Haag | on the exception handling construct Andre van Delft | the Netherlands | in Ada is far too positive