Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

A Constructive State-based Semantics and Interpreter for a Synchronous Data-flow Language with State Machines

Published: 09 September 2023 Publication History

Abstract

Scade is a domain-specific synchronous functional language used to implement safety-critical real-time software for more than twenty years. Two main approaches have been considered for its semantics: (i) an indirect collapsing semantics based on a source-to-source translation of high-level constructs into a data-flow core language whose semantics is precisely specified and is the entry for code generation; a relational synchronous semantics, akin to Esterel, that applies directly to the source. It defines what is a valid synchronous reaction but hides, on purpose, if a semantics exists, is unique and can be computed; hence, it is not executable.
This paper presents, for the first time, an executable, state-based semantics for a language that has the key constructs of Scade all together, in particular the arbitrary combination of data-flow equations and hierarchical state machines. It can apply directly to the source language before static checks and compilation steps. It is constructive in the sense that the language in which the semantics is defined is a statically typed functional language with call-by-value and strong normalization, e.g., it is expressible in a proof-assistant where all functions terminate. It leads to a reference, purely functional, interpreter. This semantics is modular and can account for possible errors, allowing to establish what property is ensured by each static verification performed by the compiler. It also clarifies how causality is treated in Scade compared with Esterel.
This semantics can serve as an oracle for compiler testing and validation; to prototype novel language constructs before they are implemented, to execute possibly unfinished models or that are correct but rejected by the compiler; to prove the correctness of compilation steps.
The semantics given in the paper is implemented as an interpreter in a purely functional style, in OCaml.

References

[1]
Joaquín Aguado, Michael Mendler, Marc Pouzet, Partha S. Roop, and Reinhard von Hanxleden. 2018. Deterministic concurrency: A clock-synchronised shared memory approach. In ESOP. Thessaloniki, Greece, 86–113.
[2]
J. Aguado, M. Mendler, R. von Hanxleden, and I. Fuhrmann. 2015. Denotational fixed-point semantics for constructive scheduling of synchronous concurrency. Acta Informatica 52, 4 (2015), 393–442.
[3]
Ch. André. 1996. Representation and analysis of reactive behaviors: A synchronous approach. In CESA. IEEE-SMC, Lille.
[4]
A. Benveniste, T. Bourke, B. Caillaud, B. Pagano, and M. Pouzet. 2014. A type-based analysis of causality loops in hybrid systems modelers. In HSCC. ACM, Berlin, Germany.
[5]
A. Benveniste, P. Caspi, S. A. Edwards, N. Halbwachs, P. Le Guernic, and R. de Simone. 2003. The synchronous languages 12 years later. Proc. IEEE 91, 1 (Jan.2003).
[6]
A. Benveniste, P. Caspi, R. Lublinerman, and S. Tripakis. 2008. Actors Without Directors: A Kahnian View of Heterogeneous Systems. Technical Report. Verimag, Centre Équation, 38610 Gières.
[7]
A. Benveniste, P. LeGuernic, and Ch. Jacquemot. 1991. Synchronous programming with events and relations: The SIGNAL language and its semantics. Science of Computer Programming 16 (1991), 103–149.
[8]
G. Berry. 1989. Real time programming: Special purpose or general purpose languages. Information Processing (1989).
[9]
G. Berry. 1993. The semantics of pure esterel. Series F: Computer and System Sciences 118 (011993).
[10]
G. Berry. 2002. The Constructive Semantics of Pure Esterel, Draft Version 3. (2002).
[11]
G. Berry and G. Gonthier. 1992. The Esterel synchronous programming language, design, semantics, implementation. Science of Computer Programming 19, 2 (1992), 87–152.
[12]
G. Berry and L. Rieg. 2019. Towards coq-verified esterel semantics and compiling. CoRR abs/1909.12582 (2019).
[13]
D. Biernacki, J. L. Colaco, G. Hamon, and Marc Pouzet. 2008. Clock-directed modular code generation of synchronous data-flow languages. In ACM LCTES. Tucson, Arizona.
[14]
S. Boulmé and G. Hamon. 2001. Certifying synchrony for free. In LPAR, Vol. 2250. La Havana, Cuba.
[15]
T. Bourke, L. Brun, P.-É. Dagand, X. Leroy, M. Pouzet, and L. Rieg. 2017. A formally verified compiler for Lustre. In PLDI.
[16]
T. Bourke, L. Brun, and M. Pouzet. 2020. Mechanized semantics and verified compilation for a dataflow synchronous language with reset. In POPL. ACM.
[17]
T. Bourke, B. Pesin, and M. Pouzet. 2023. Verified compilation of synchronous dataflow with state machines. In EMSOFT.
[18]
T. Bourke and M. Pouzet. 2013. Zélus, a synchronous language with ODEs. In HSCC. ACM, Philadelphia, USA.
[19]
P. Caspi. 1992. Clocks in dataflow languages. Theoretical Computer Science 94 (1992), 125–140.
[20]
P. Caspi, D. Pilaud, N. Halbwachs, and J. Plaice. 1987. Lustre: A declarative language for programming synchronous systems. In POPL. ACM.
[21]
P. Caspi and M. Pouzet. 1996. Synchronous kahn networks. In ACM ICFP. Philadelphia, Pensylvania.
[22]
P. Caspi and M. Pouzet. 1998. A co-iterative characterization of synchronous stream functions. In CMCS’98.
[23]
J. L. Colaço, G. Hamon, and M. Pouzet. 2006. Mixing signals and modes in synchronous data-flow systems. In ACM EMSOFT. Seoul, South Korea.
[24]
J. L. Colaço, B. Pagano, and M. Pouzet. 2005. A conservative extension of synchronous data-flow with state machines. In ACM EMSOFT. Jersey city, New Jersey, USA.
[25]
J. L. Colaço and M. Pouzet. 2003. Clocks as first class abstract types. In ACM EMSOFT. Philadelphia, USA.
[26]
J. L. Colaco, B. Pagano, and M. Pouzet. 2017. Scade 6: A formal language for embedded critical software development. In Symposium on Theoretical Aspect of Software Engineering (TASE’17). Sophia Antipolis, France.
[27]
S. A. Edwards and E. A. Lee. 2003. The semantics and execution of a synchronous block-diagram language. Science of Computer Programming 48 (2003), 21–42.
[28]
G. Gonthier. 1988. Sémantiques et modèles d’exécution des langages réactifs synchrones. Ph. D. Dissertation. Université d’Orsay.
[29]
N. Halbwachs. 1984. Modélisation et analyse du comportement des systèmes informatiques temporisés. Ph. D. Dissertation. Institut National Polytechnique de Grenoble - INPG; Université Joseph - Fourier - Grenoble I.
[30]
N. Halbwachs, P. Caspi, P. Raymond, and D. Pilaud. 1991. The synchronous dataflow programming language Lustre. Proc. IEEE 79, 9 (September1991), 1305–1320.
[31]
N. Halbwachs, P. Raymond, and C. Ratel. 1991. Generating efficient code from data-flow programs. In Third International Symposium on Programming Language Implementation and Logic Programming. Passau (Germany).
[32]
D. Harel. 1987. StateCharts: A visual approach to complex systems. Science of Computer Programming 8-3 (1987), 231–275.
[33]
P. Hudak, A. Courtney, H. Nilsson, and J. Peterson. 2003. Arrows, Robots, and Functional Reactive Programming. Springer, Berlin, 159–187.
[34]
B. Jacobs and J. Rutten. 1997. A tutorial on (co)algebras and (co)induction. EATCS Bulletin 62 (1997), 222–259.
[35]
G. Kahn. 1974. The semantics of a simple language for parallel programming. In IFIP 74 Congress. North Holland, Amsterdam.
[36]
E. A. Lee and A. Sangiovanni-Vincentelli. 1998. A framework for comparing models of computation. IEEE Transactions on CAD 17, 12 (December1998).
[37]
Xavier Leroy. 2021. The Compcert Verified Compiler. http://compcert.inria.fr/doc/index.html
[38]
S. Malik. 1994. Analysis of cyclic combinational circuits. IEEE Trans. on CAD of Integrated Circuits and Systems 13, 7 (1994).
[39]
F. Maraninchi. 1991. The Argos Language: Graphical representation of automata and description of reactive systems. In IEEE Workshop on Visual Languages. Kobe, Japan.
[40]
F. Maraninchi and F. Gaucher. 2000. Step-wise + algorithmic debugging for reactive programs: LuDiC, a debugger for Lustre. In AADEBUG’2000 – Fourth International Workshop on Automated Debugging. Munich.
[41]
F. Maraninchi and Y. Rémond. 2003. Mode-automata: A new domain-specific construct for the development of safe critical systems. Science of Computer Programming46 (2003), 219–254.
[42]
G. H. Mealy. 1955. A method for synthesizing sequential circuits. Bell System Technical Journal 34, 5 (1955), 1045–1079.
[43]
R. Paterson. 2001. A new notation for arrows. In ICFP (Firenze, Italy). ACM Press, 229–240.
[44]
C. Paulin-Mohring. 1995. Circuits as streams in coq: Verification of a sequential multiplier. In TYPES. Springer.
[45]
Ch. Paulin-Mohring. 2009. A constructive denotational semantics for Kahn networks in Coq. In From Semantics to Computer Science, Y. Bertot, G. Huet, J. J. Lévy, and G. Plotkin (Eds.). Cambridge University Press, 383–413.
[46]
M. Pouzet. 2006. Lucid Synchrone, version 3. Tutorial and reference manual. Université Paris-Sud, LRI.
[47]
John C. Reynolds. 1998. Theories of Programming Languages. Cambridge University Press.
[48]
Klaus Schneider and Jens Brandt. 2016. Handbook of Hardware/Software Codesign. S. Ha and J. Teich (Eds); Springer Science+Business Media Dordrecht, Chapter Quartz: A Synchronous Language for Model-Based Design of Reactive Embedded Systems.
[49]
Klaus Schneider, Jens Brandt, Tobias Schüle, and Thomas Türk. 2005. Maximal causality analysis. In Conference on Application of Concurrency to System Design (ACSD’05). St. Malo, France, 106–115.
[50]
O. Tardieu. 2004. A deterministic logical semantics for esterel. In SOS Workshop. London, United Kingdom.
[51]
R. von Hanxleden, B. Duderstadt, C. Motika, S. Smyth, M. Mendler, J. Aguado, S. Mercer, and O. O’Brien. 2014. SCCharts: Sequentially constructive statecharts for safety-critical applications. In PLDI’14.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Embedded Computing Systems
ACM Transactions on Embedded Computing Systems  Volume 22, Issue 5s
Special Issue ESWEEK 2023
October 2023
1394 pages
ISSN:1539-9087
EISSN:1558-3465
DOI:10.1145/3614235
  • Editor:
  • Tulika Mitra
Issue’s Table of Contents

Publisher

Association for Computing Machinery

New York, NY, United States

Journal Family

Publication History

Published: 09 September 2023
Accepted: 30 June 2023
Revised: 02 June 2023
Received: 23 March 2023
Published in TECS Volume 22, Issue 5s

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Programming language
  2. dynamic semantics
  3. synchronous programming
  4. embedded software

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 170
    Total Downloads
  • Downloads (Last 12 months)86
  • Downloads (Last 6 weeks)10
Reflects downloads up to 23 Dec 2024

Other Metrics

Citations

View Options

Login options

Full Access

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Full Text

View this article in Full Text.

Full Text

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media