skip to main content
10.1145/3281074.3281077acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Recognizing heterogeneous sequences by rational type expression

Published: 05 November 2018 Publication History

Abstract

We summarize a technique for writing functions which recognize types of heterogeneous sequences in Common Lisp. The technique employs sequence recognition functions, generated at compile time, and evaluated at run-time. The technique we demonstrate extends the Common Lisp type system, exploiting the theory of rational languages, Binary Decision Diagrams, and the Turing complete macro facility of Common Lisp. The resulting system uses meta-programming to move an Omega(2^n) complexity operation from run-time to a compile-time operation, leaving a highly optimized Theta(n) complexity operation for run-time.

References

[1]
S. B. Akers. Binary decision diagrams. IEEE Trans. Comput., 27(6):509-516, June 1978.
[2]
Henrik Reif Andersen. An introduction to binary decision diagrams. Technical report, Course Notes on the WWW, 1999.
[3]
Anonymous. The Common Lisp Object Standard (CLOS), October 1987. 1 videocassette (VHS) (53 min.).
[4]
Ansi. American National Standard: Programming Language - Common Lisp. ANSI X3.226:1994 (R1999), 1994.
[5]
Lennart Augustsson. Compiling pattern matching. In Proc. Of a Conference on Functional Programming Languages and Computer Architecture, pages 368-381, New York, NY, USA, 1985. Springer-Verlag New York, Inc.
[6]
J. R. Burch, E. M. Clarke, K. L. McMillan, D. L. Dill, and L. J. Hwang. Symbolic model checking: 1020 states and beyond. Inf. Comput., 98(2):142-170, June 1992.
[7]
D. G. Bobrow, K. Kahn, G. Kiczales, L. Masinter, Stefik, M., and F. Zdybel. Common Loops, merging Lisp and object-oriented programming. j-SIGPLAN, 21(11):17-29, November 1986.
[8]
Jim Blandy. The Rust Programming Language: Fast, Safe, and Beautiful. O'Reilly Media, Inc., 2015.
[9]
K. S. Brace, R. L. Rudell, and R. E. Bryant. Efficient implementation of a bdd package. In 27th ACM/IEEE Design Automation Conference, pages 40-45, Jun 1990.
[10]
Randal E. Bryant. Graph-Based Algorithms for Boolean Function Manipulation. IEEE Transactions on Computers, 35:677-691, August 1986.
[11]
Randal E. Bryant. Symbolic boolean manipulation with ordered binary-decision diagrams. ACM Comput. Surv., 24(3):293-318, September 1992.
[12]
Janusz A. Brzozowski. Derivatives of regular expressions. J. ACM, 11(4):481-494, October 1964.
[13]
Eugene Burmako. Scala macros: Let our powers combine!: On how rich syntax and static types work with metaprogramming. In Proceedings of the 4th Workshop on Scala, SCALA '13, pages 3:1-3:10, New York, NY, USA, 2013. ACM.
[14]
Giuseppe Castagna. Covariance and contravariance: a fresh look at an old issue. Technical report, CNRS, 2016.
[15]
Paul Chiusano and Rnar Bjarnason. Functional Programming in Scala. Manning Publications Co., Greenwich, CT, USA, 1st edition, 2014.
[16]
Olivier Coudert, Christian Berthet, and Jean Christophe Madre. Verification of synchronous sequential machines based on symbolic execution. In Proceedings of the International Workshop on Automatic Verification Methods for Finite State Systems, pages 365-373, London, UK, UK, 1990. Springer-Verlag.
[17]
Pascal Costanza and Theo D'Hondt. Embedding hygiene-compatible macros in an unhygienic macro system. Journal of Universal Computer Science, 16(2):271-295, jan 2010.
[18]
Tongfei Chen. Typesafe abstractions for tensor operations. CoRR, abs/1710.06892, 2017.
[19]
G. Castagna and V. Lanvin. Gradual typing with union and intersection types. Proc. ACM Program. Lang., (1, ICFP '17, Article 41), sep 2017.
[20]
Eugene Charniak and Drew McDermott. Introduction to Artificial Intelligence. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1985.
[21]
Maximilien Colange. Symmetry Reduction and Symbolic Data Structures for Model Checking of Distributed Systems. Thèse de doctorat, Laboratoire de l'Informatique de Paris VI, Université Pierre-et-Marie-Curie, France, December 2013.
[22]
Clemens Gröpl, Hans Jürgen Prömel, and Anand Srivastav. Size and structure of random ordered binary decision diagrams. In STACS 98, pages 238-248. Springer Berlin Heidelberg, 1998.
[23]
Paul Graham. ANSI Common Lisp. Prentice Hall Press, Upper Saddle River, NJ, USA, 1996.
[24]
John E. Hopcroft, Rajeev Motwani, and Jeffrey D. Ullman. Introduction to Automata Theory, Languages, and Computation (3rd Edition). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 2006.
[25]
Juraj Hromkovi?. Descriptional complexity of finite automata: Concepts and open problems. J. Autom. Lang. Comb., 7(4):519- 531, September 2002.
[26]
Haruo Hosoya, Jérôme Vouillon, and Benjamin C. Pierce. Regular expression types for XML. ACM Trans. Program. Lang. Syst., 27(1):46-90, January 2005.
[27]
Nicolai M. Josuttis. The C++ Standard Library: A Tutorial and Reference. Addison-Wesley Professional, 2nd edition, 2012.
[28]
Alan C. Kay. The Reactive Engine. PhD thesis, University of Utah, 1969.
[29]
Sonja E. Keene. Object-Oriented Programming in Common Lisp: a Programmer's Guide to CLOS. Addison-Wesley, 1989.
[30]
Donald E. Knuth. The Art of Computer Programming, Volume 4, Fascicle 1: Bitwise Tricks & Techniques; Binary Decision Diagrams. Addison-Wesley Professional, 12th edition, 2009.
[31]
C. Y. Lee. Representation of switching circuits by binary-decision programs. Bell System Technical Journal, 38(4):985-999, 1959.
[32]
Luc Maranget. Compiling pattern matching to good decision trees. In Proceedings of the 2008 ACM SIGPLAN Workshop on ML, ML '08, pages 35-46, New York, NY, USA, 2008. ACM.
[33]
M. Douglas McIlroy. Macro instruction extensions of compiler languages. Commun. ACM, 3:214-220, April 1960.
[34]
Jim Newton, Akim Demaille, and Didier Verna. Type-Checking of Heterogeneous Sequences in Common Lisp. In European Lisp Symposium, Kraków, Poland, May 2016.
[35]
William H. Newman. Steel Bank Common Lisp user manual, 2015.
[36]
Jim Newton. Report: Efficient Dynamic Type Checking of Heterogeneous Sequences. Technical report, EPITA/LRDE, 2016.
[37]
Jim Newton. Analysis of algorithms calculating the maximal disjoint decomposition of a set. Technical report, EPITA/LRDE, 2017.
[38]
Jim Newton and Didier Verna. Strategies for typecase optimization. In European Lisp Symposium, Marbella, Spain, April 2018.
[39]
Jim Newton, Didier Verna, and Maximilien Colange. Programmatic manipulation of Common Lisp type specifiers. In European Lisp Symposium, Brussels, Belgium, April 2017.
[40]
Scott Owens, John Reppy, and Aaron Turon. Regular-expression derivatives re-examined. J. Funct. Program., 19(2):173-190, March 2009.
[41]
Martin Odersky, Lex Spoon, and Bill Venners. Programming in Scala: A Comprehensive Step-by-step Guide. Artima Incorporation, USA, 1st edition, 2008.
[42]
Benjamin C. Pierce. Types and Programming Languages. The MIT Press, 1st edition, 2002.
[43]
Christian Queinnec. Compilation of non-linear, second order patterns on s-expressions. In Proceedings of the 2Nd International Workshop on Programming Language Implementation and Logic Programming, PLILP '90, pages 340-357, London, UK, UK, 1990. Springer-Verlag.
[44]
Christophe Rhodes. User-extensible Sequences in Common Lisp. In Proceedings of the 2007 International Lisp Conference, ILC '07, pages 13:1-13:14, New York, NY, USA, 2009. ACM.
[45]
Karsten Strehl and Lothar Thiele. Symbolic model checking of process networks using interval diagram techniques. In Proceedings of the 1998 IEEE/ACM International Conference on Computer-aided Design, ICCAD '98, pages 686-692, New York, NY, USA, 1998. ACM.
[46]
Bjarne Stroustrup. The C++ Programming Language. Addison-Wesley Professional, 4th edition, 2013.
[47]
Andrew Wright and Bruce F. Duba. Pattern matching for scheme, 1995.
[48]
Ingo Wegener. The Complexity of Boolean Functions. John Wiley & Sons, Inc., New York, NY, USA, 1987.
[49]
Edmund Weitz. Common Lisp Recipes: A Problem-solution Approach. Apress, 2015.
[50]
Guangming Xing. Minimized Thompson NFA. Int. J. Comput. Math., 81(9):1097-1106, 2004.
[51]
Francois Yvon and Akim Demaille. Théorie des Langages Rationnels. EPITA LRDE, 2014. Lecture notes.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
META 2018: Proceedings of the 3rd ACM SIGPLAN International Workshop on Meta-Programming Techniques and Reflection
November 2018
22 pages
ISBN:9781450360685
DOI:10.1145/3281074
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 05 November 2018

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Finite automata
  2. code generation
  3. dynamic languages
  4. lisp
  5. rational languages
  6. type checking

Qualifiers

  • Research-article

Conference

SPLASH '18
Sponsor:

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 43
    Total Downloads
  • Downloads (Last 12 months)6
  • Downloads (Last 6 weeks)1
Reflects downloads up to 30 Jan 2025

Other Metrics

Citations

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media