Skip to main content
Log in

Practical type checking of functions defined on Context-Free languages

  • Software Engineering
  • Published:
Journal of Computer Science and Technology Aims and scope Submit manuscript

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Chen H. Function definition language FDL and its implementation.Journal of Comput. Sci. & Technol, 1999, 14(4): 414–421.

    Article  Google Scholar 

  2. Chen H, Dong Y. A formal specification language facilitating specification acquisition.Chinese Journal of Computers, 2002, 25(5): 459–466. (in Chinese)

    MATH  MathSciNet  Google Scholar 

  3. 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.

  4. Chen H, Dong Y. Yet another meta-language for programming language processing.ACM SIGPLAN Notices, 2002, 37(6): 28–37.

    Article  Google Scholar 

  5. 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.

  6. Dong Y. MLIRF method for specification acquisition and reuse. InProc. the 9th National Conf. China Computer Federation. May 1996, pp. 21–27. (in Chinese)

  7. 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.

    MATH  MathSciNet  Google Scholar 

  8. 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.

    Google Scholar 

  9. Pierce B C, Types and Programming Languages. MIT Press, Cambridge, Mass., 2002.

    Google Scholar 

  10. 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.

    Google Scholar 

  11. 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.

  12. Hindley R. The principal type-scheme of an object in combinatory logic.Trans. Amer. Math. Soc., 1969, 146: 29–60.

    MATH  MathSciNet  Google Scholar 

  13. Milner R. A theory of type polymorphism in programming.Journal of Computer and System Sciences Dec. 1978, 17(3): 348–375.

    Article  MATH  MathSciNet  Google Scholar 

  14. Milner R, Tofte M, Harper R. The Definition of Standard ML. The MIT Press, 1990.

  15. Mitchell J C. Type inference with simple subtype.Journal of Functional Programming, July 1991, 1(3): 245–285.

    Article  MATH  MathSciNet  Google Scholar 

  16. Earley J. An efficient context-free parsing algorithm.Comm. ACM, 1970, 13: 94–102.

    Article  MATH  Google Scholar 

  17. Hosoya H, Pierce B. XDuce: A statically typed XML processing language.ACM Transactions on Internet Technology, 2003, 3(2): 117–148.

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to Hai-Ming Chen or Yun-Mei Dong.

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

Reprints 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

Download citation

  • Received:

  • Revised:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF02973447

Keywords

Navigation