Abstract
In this paper, we present an intermediate representation (IR) language for the concise and generalized description of type system specification features in dynamically typed programming languages. The intermediate representation is based on pattern matching and features type-level computation. It is inspired by the intermediate representation “Assembly language” for Refal-2. In contrast to “Assembly language,” the proposed representation is based on the control flow graph, which preserves typing information, rather than on bytecode. In addition, we propose a modification of the Refal language that supports higher-order functions, closures, and “associative array” data type, as well as a transpiler of programs from the language into the intermediate representation. In terms of this language, we present two examples of type system specification: simple types and row polymorphism. These examples are of interest for describing type systems for dynamically typed programming languages.
Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.REFERENCES
Hufschmidt, T., A type-system for Nix. http://nixcon2017.org/schedule.nixcon2017.org/system/event_attachments/attachments/000/000/003/original/main.pdf.
Siek, J. and Taha, W., Gradual typing for objects, Proc. European Conf. on Object-Oriented Programming (ECOOP), Ernst, E., Ed., Berlin: Springer, 2007, pp. 2–27.
Levkivskyi, I., Lehtosalo, J., and Langa, L., PEP 544 – Protocols: Structural subtyping (static duck typing). http://www.python.org/dev/peps/pep-0544. Accessed January 10, 2019.
Turchin, V.F., Meta-algorithmic language, Kibernetika, 1968, no. 4, pp. 45–54.
Turchin, V.F., REFAL-5: Programming Guide and Reference Manual, Holyoke: New England, 1989.
Vasenin, V.A. and Krivchikov, M.A., Methods for intermediate representation of programs, Program. Inzheneriya, 2017, vol. 8, no. 8, pp. 345–353.
Romanenko, S.A., Machine-independent compiler from the recursive function language, Cand. Sci. (Fiz.-Mat.) Dissertation, Moscow: Inst. Prikl. Mat. Keldysha, 1978.
Nemytykh, A.P., Superkompilyator SCP-4: obshchaya struktura (SCP-4 Supercompiler: General Structure), Moscow: Izd-vo LKI, 2007.
Romanenko, S.A. and Gurin, R.F., Yazyk programmirovaniya Refal Plyus (Refal Plus Programming Language), Pereslavl’-Zalesskii: Univ. Pereslavlya im. A.K. Ailamazyana, 2006.
Turchin, V.F., Ekvivalentnye preobrazovaniya rekursivnykh funktsii, opisannykh na yazyke REFAL (Equivalent Transformations of Recursive Functions Described in the REFAL Language), Kiev-Alushta, 1972, pp. 31–42.
Wand, M., Type inference for record concatenation and multiple inheritance, Inf. Comput., 1991, vol. 93, no. 1, pp. 1–15.
Stefik, A. and Siebert, S., An empirical investigation into programming language syntax, Trans. Comput. Educ., 2013, vol. 13, no. 4, pp. 19:1–19:40.
Shelekhov, V.I., Verification and synthesis of efficient programs of standard functions in the predicate programming technology, Program. Inzheneriya, 2011, no. 2, pp. 14–21.
Lisitsa, A.P. and Nemytykh, A.P., Verification as a parameterized testing (experiments with the SCP4 supercompiler), Program. Comput. Software, 2007, vol. 33, no. 1, pp. 14–23.
Lisitsa, A.P. and Nemytykh, A.P., On one application of computations with oracle, Program. Comput. Software, 2010, vol. 36, no. 3, pp. 157–165.
Klyuchnikov, I.G. and Romanenko, S.A., Supercompilation for Martin-Lof’s type theory, Program. Comput. Software, 2015, vol. 41, no. 3, pp. 170–182.
Novikov, F.A. and Novoseltsev, V.B., Interpretable program specification language, Program. Comput. Software, 2010, vol. 36, no. 1, pp. 48–57.
Shankar, N. and Owre, S., Principles and pragmatics of subtyping in PVS, Recent Trends in Algebraic Development Techniques, Bert, D., Choppy, C., and Mosses, P.D., Eds., Springer, 1999, vol. 1827, pp. 37–52.
Funding
This work was supported by the Russian Foundation for Basic Research, project no. 16-07-01178a.
Author information
Authors and Affiliations
Corresponding authors
Additional information
Translated by Yu. Kornienko
Rights and permissions
About this article
Cite this article
Vasenin, V.A., Krivchikov, M.A. Intermediate Representation of Programs with Type Specification Based on Pattern Matching. Program Comput Soft 46, 57–66 (2020). https://doi.org/10.1134/S0361768820010077
Received:
Revised:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1134/S0361768820010077