Skip to main content

2016 | OriginalPaper | Buchkapitel

Declarative Programming with Algebra

verfasst von : Andre van Delft, Anatoliy Kmetyuk

Erschienen in: Functional and Logic Programming

Verlag: Springer International Publishing

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

The Algebra of Communicating Processes (ACP) is a theory that views sequences and choices as mathematical operations: multiplication and addition. Based on these base constructs others are defined, such as parallel merge, interruption and disruption.
Conventional programming languages may be enriched with ACP features, to gain declarative expressiveness. We have done this in SubScript, an extension to the Scala language. SubScript has high level support for sequences, choices and iterations in a style similar to parser generator languages. It also offers parallel composition operations, such as and- and or- parallelism, and dataflow.
The declarative style is also present in the way various execution modes are supported. Conventional programming languages often require some boilerplate code to run things in the background, in the GUI thread, or as event handlers. SubScript supports the same execution modes, but with minimal boilerplate. It is also easy to compose programs from blocks having different execution modes.
This paper introduces ACP and SubScript; it briefly describes the current implementation, and gives several examples.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Fußnoten
1
This paper contains some text fragments literally copied or adapted from the predecessor paper.
 
2
This description of ACP has largely been taken from Wikipedia.
 
3
There is also a semicolon to denote sequences. SubScript has a similar semicolon inference for line breaks as Scala.
 
4
We can combine this way any kind of item for which implicit conversions to scripts are in scope; this yields an algebra of general items rather than just of processes.
 
5
In general Scala’s operator precedence rules are followed, except for the dataflow operators; in Scala white space denotes function application; in SubScript it is sequential composition.
 
6
Library scripts that refine into such special processes, may be more readable. For the time being we want a minimal set of new keywords.
 
7
For convenience here is an implicit value so that it may be left out of parameter lists that have an implicit formal parameter of the node’s type.
 
8
In annotations there is implicit instead of here. Thus @gui: is equivalent to @gui(there).
 
9
These operators start with a percent sign; they are members of a larger family of operators that can suspend and resume operands. These operators are not meant to be memorized; rather they may be encapsulated in higher level scripts with descriptive names.
 
10
https://static-content.springer.com/image/chp%3A10.1007%2F978-3-319-29604-3_15/417706_1_En_15_IEq19_HTML.gif is also valid syntax; this requires an implicit conversion to be in scope that turns the number into a script call.
 
11
A useful definition for https://static-content.springer.com/image/chp%3A10.1007%2F978-3-319-29604-3_15/417706_1_En_15_IEq24_HTML.gif (see Sect. 4.9) triggered several syntax changes. E.g. rectangular brackets replaced parentheses to delimit process expressions. Script lambda’s are now also written between rectangular brackets. Script terms may now have the form (s) or {s}, with s a Scala value; such terms are method calls or script calls, possibly after implicit conversion. Normal code fragments had the form {s}; this became {!s!}.
 
13
Subscript web site: http://​subscript-lang.​org.
 
Literatur
1.
Zurück zum Zitat Thati, P., Agha, G.: An algebraic theory of actors and its application to a simple object-based language. In: Owe, O., Krogdahl, S., Lyche, T. (eds.) From Object-Orientation to Formal Methods. LNCS, vol. 2635, pp. 26–57. Springer, Heidelberg (2004)CrossRef Thati, P., Agha, G.: An algebraic theory of actors and its application to a simple object-based language. In: Owe, O., Krogdahl, S., Lyche, T. (eds.) From Object-Orientation to Formal Methods. LNCS, vol. 2635, pp. 26–57. Springer, Heidelberg (2004)CrossRef
3.
Zurück zum Zitat Boussinot, F.: Reactive c: an extension of c to program reactive systems. Softw. Pract. Experiance 21(4), 401–428 (1991)CrossRef Boussinot, F.: Reactive c: an extension of c to program reactive systems. Softw. Pract. Experiance 21(4), 401–428 (1991)CrossRef
4.
Zurück zum Zitat Boussinot, F., Susini, J.F.: The sugarcubes tool box. In: Nets of Reactive Processes Implementation Boussinot, F., Susini, J.F.: The sugarcubes tool box. In: Nets of Reactive Processes Implementation
5.
Zurück zum Zitat van Delft, A.: Dataflow constructs for a language extension based on the algebra of communicating processes. In: Proceedings of 4th Workshop on Scala, SCALA 2013. ACM (2013) van Delft, A.: Dataflow constructs for a language extension based on the algebra of communicating processes. In: Proceedings of 4th Workshop on Scala, SCALA 2013. ACM (2013)
7.
Zurück zum Zitat Gaspari, M., Zavattaro, G.: An algebra of actors. In: Ciancarini, P., Fantechi, A., Gorrieri, R. (eds.) FMOODS, IFIP Conference Proceedings, vol. 139. Kluwer (1999) Gaspari, M., Zavattaro, G.: An algebra of actors. In: Ciancarini, P., Fantechi, A., Gorrieri, R. (eds.) FMOODS, IFIP Conference Proceedings, vol. 139. Kluwer (1999)
8.
Zurück zum Zitat Goeman, H.: Towards a theory of (self) applicative communicating processes: a short note. Inf. Process. Lett. 34(3), 139–142 (1990)MathSciNetCrossRefMATH Goeman, H.: Towards a theory of (self) applicative communicating processes: a short note. Inf. Process. Lett. 34(3), 139–142 (1990)MathSciNetCrossRefMATH
9.
10.
Zurück zum Zitat Johnson, S.: Yacc: Yet another compiler- compiler. Technical report, Bell Laboratories (1979) Johnson, S.: Yacc: Yet another compiler- compiler. Technical report, Bell Laboratories (1979)
11.
Zurück zum Zitat Milner, R.: A Calculus of Communicating Systems. Springer-Verlag New York Inc., Secaucus (1982)MATH Milner, R.: A Calculus of Communicating Systems. Springer-Verlag New York Inc., Secaucus (1982)MATH
13.
Zurück zum Zitat Wang, Y.: Fully abstract game semantics for actors. CoRR abs/1403.6563 (2014) Wang, Y.: Fully abstract game semantics for actors. CoRR abs/1403.6563 (2014)
14.
Zurück zum Zitat Wills, P.: No more regular expressions. Scala Exchange, Skills Matter, London (2014) Wills, P.: No more regular expressions. Scala Exchange, Skills Matter, London (2014)
Metadaten
Titel
Declarative Programming with Algebra
verfasst von
Andre van Delft
Anatoliy Kmetyuk
Copyright-Jahr
2016
DOI
https://doi.org/10.1007/978-3-319-29604-3_15