Abstract
A type checking method for the functional language LFC is presented. A distinct feature of LFC is that it uses Context-Free (CF) languages as data types to represent compound data structures. This makes LFC a dynamically typed language. To improve efficiency, a practical type checking method is presented, which consists of both static and dynamic type checking. Although the inclusion relation of CF languages is not decidable, a special subset of the relation is decidable, i.e., the sentential form relation, which can be statically checked. Moreover, most of the expressions in actual LFC programs appear to satisfy this relation according to the statistic data of experiments. So, despite that the static type checking is not complete, it undertakes most of the type checking task. Consequently the run-time efficiency is effectively improved. Another feature of the type checking is that it converts the expressions with implicit structures to structured representation. Structure reconstruction technique is presented.
Similar content being viewed by others
References
Chen H. Function definition language FDL and its implementation.Journal of Comput. Sci. & Technol, 1999, 14(4): 414–421.
Chen H, Dong Y. A formal specification language facilitating specification acquisition.Chinese Journal of Computers, 2002, 25(5): 459–466. (in Chinese)
Dong Y, Li K, Chen Het al. Design and implementation of the formal specification acquisition system SAQ. InProceedings of Conference on Software: Theory and Practice, IFIP 16th World Computer Congress 2000, Beijing, China, August 21–25, 2000, Publishing House of Electronic Industry, pp. 201–211.
Chen H, Dong Y. Yet another meta-language for programming language processing.ACM SIGPLAN Notices, 2002, 37(6): 28–37.
Dong Yet al. Collection of SAQ reports Nos. 1–16. Technical Reports ISCAS-LCS-95-09 (August 1995), ISCAS-LCS-96-1 (March 1996), Computer Science Laboratory, Institute of Software, the Chinese Academy of Sciences.
Dong Y. MLIRF method for specification acquisition and reuse. InProc. the 9th National Conf. China Computer Federation. May 1996, pp. 21–27. (in Chinese)
Dong Y. Recursive functions of context free languages (I)—The definitions of CFPRF and CFRF.Science in China, Series F, 2002, 45(1): 25–39.
Dong Y. Recursive functions of context free languages (II)—Validity of CFPRF and CFRF definitions.Science in China, Series F, 2002, 45(2), 1–21.
Pierce B C, Types and Programming Languages. MIT Press, Cambridge, Mass., 2002.
Chen H, Dong Y. Practical type checking of functions defined on context-free languages. InProc. the Sixth Int. Conf. Young Computer Scientists (IGYCS'2001), Oct. 23–25, 2001, Hangzhou, China, Beijing: International Academic Publishers, World Publishing Corporation, pp. 1261–1263.
Chen H, Dong Y. Incorporating static type-checking into functions defined on context-free languages.SOFSEM 2004: Theory and Practice of Computer Science, Proceedings Volume II. Merin, Czech Republic, January 24–30, 2004, Prague: MATFYZ PRESS, pp. 39–47.
Hindley R. The principal type-scheme of an object in combinatory logic.Trans. Amer. Math. Soc., 1969, 146: 29–60.
Milner R. A theory of type polymorphism in programming.Journal of Computer and System Sciences Dec. 1978, 17(3): 348–375.
Milner R, Tofte M, Harper R. The Definition of Standard ML. The MIT Press, 1990.
Mitchell J C. Type inference with simple subtype.Journal of Functional Programming, July 1991, 1(3): 245–285.
Earley J. An efficient context-free parsing algorithm.Comm. ACM, 1970, 13: 94–102.
Hosoya H, Pierce B. XDuce: A statically typed XML processing language.ACM Transactions on Internet Technology, 2003, 3(2): 117–148.
Author information
Authors and Affiliations
Corresponding authors
Additional information
This work is supported by the National Science Foundation of China under Grant Nos. 60103008 and 60273023.
Hai-Ming Chen received his B.S. degree in computer science and technology from University of Science and Technology of China in 1989, and his M.S. degree and Ph.D. degree in computer software and theory from Institute of Software, the Chinese Academy of Sciences (CAS) in 1992 and 1999, respectively. He is now a professor at Laboratory of Computer Science, Institute of Software, CAS. He has been working on software reuse, Chinese font techniques, and formal specifications. His recent research interests include formal methods and programming languages.
Yun-Mei Dong graduated from Jilin University in 1956. He is a professor at Laboratory of Computer Science, Institute of Software, the Chinese Academy of Sciences (CAS). He is an academician of CAS. Before 1995, he had worked in several research areas including formal languages, compiler techniques, Chinese font design techniques, and software reuse. His current research interests are in software design methodologies and formal specifications.
Rights and permissions
About this article
Cite this article
Chen, HM., Dong, YM. Practical type checking of functions defined on Context-Free languages. J. Comput. Sci. & Technol. 19, 840–847 (2004). https://doi.org/10.1007/BF02973447
Received:
Revised:
Published:
Issue Date:
DOI: https://doi.org/10.1007/BF02973447