Skip to main content

Featherweight TeX and Parser Correctness

  • Conference paper
Software Language Engineering (SLE 2010)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 6563))

Included in the following conference series:

Abstract

TeX (and its LaTeX incarnation) is a widely used document preparation system for technical and scientific documents. At the same time, TeX is also an unusual programming language with a quite powerful macro system. Despite the wide range of TeX users (especially in the scientific community), and despite a widely perceived considerable level of “pain” in using TeX, there is almost no research on TeX. This paper is an attempt to change that.

To this end, we present Featherweight TeX, a formal model of TeX which we hope can play a similar role for TeX as Featherweight Java did for Java. The main technical problem which we study in terms of Featherweight TeX is the parsing problem. As for other dynamic languages performing syntactic analysis at runtime, the concept of “static” parsing and its correctness is unclear in TeX and shall be clarified in this paper. Moreover, it is the case that parsing TeX is impossible in general, but we present evidence that parsers for practical subsets exists.

We furthermore outline three immediate applications of our formalization of TeX and its parsing: a macro debugger, an analysis that detects syntactic inconsistencies, and a test framework for TeX parsers.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. NTS: A New Typesetting System, http://nts.tug.org/ (visited on 20.03.2010)

  2. Badros, G.J., Notkin, D.: A Framework for Preprocessor-Aware C Source Code Analyses. Software: Practice and Experience 30(8), 907–924 (2000)

    Google Scholar 

  3. Brabrand, C., Schwartzbach, M.I.: Growing Languages with Metamorphic Syntax Macros. In: Partial Evaluation and Semantics-Based Program Manipulation, pp. 31–40. ACM, New York (2002)

    Google Scholar 

  4. Eijkhout, V.: TeX by Topic, A TeXnicans Reference. Addison-Wesley, Reading (1992)

    Google Scholar 

  5. Garrido, A., Johnson, R.: Refactoring C with Conditional Compilation. In: Automated Software Engineering, pp. 323–326. IEEE Computer Society, Los Alamitos (2003)

    Google Scholar 

  6. Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java - A Minimal Core Calculus for Java and GJ. ACM Transactions on Programming Languages and Systems, 132–146 (1999)

    Google Scholar 

  7. Knuth, D.E.: The TeX Book. Addison-Wesley, Reading (1984)

    MATH  Google Scholar 

  8. Knuth, D.E.: TeX: The Program. Addison-Wesley, Reading (1986)

    MATH  Google Scholar 

  9. Kohlbecker, E.E., Friedman, D.P., Felleisen, M., Duba, B.F.: Hygienic Macro Expansion. In: LISP and Functional Programming, pp. 151–161. ACM, New York (1986)

    Google Scholar 

  10. Lamport, L.: LaTeX: A Document Preparation System. Addison-Wesley, Reading (1986)

    MATH  Google Scholar 

  11. Latendresse, M.: Rewrite Systems for Symbolic Evaluation of C-like Preprocessing. In: European Conference on Software Maintenance and Reengineering, pp. 165–173. IEEE Computer Society, Los Alamitos (2004)

    Google Scholar 

  12. Livadas, P.E., Small, D.T.: Understanding Code Containing Preprocessor Constructs. In: Program Comprehension, pp. 89–97. IEEE Comp. Society, Los Alamitos (1994)

    Google Scholar 

  13. Padioleau, Y.: Parsing C/C++ Code without Pre-processing. In: de Moor, O., Schwartzbach, M.I. (eds.) CC 2009. LNCS, vol. 5501, pp. 109–125. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  14. Saebjoernsen, A., Jiang, L., Quinlan, D.J., Su, Z.: Static Validation of C Preprocessor Macros. In: Automated Software Engineering, pp. 149–160. IEEE Computer Society, Los Alamitos (2009)

    Google Scholar 

  15. Weise, D., Crew, R.: Programmable Syntax Macros. In: Programming Language Design and Implementation, pp. 156–165. ACM, New York (1993)

    Google Scholar 

  16. Wright, A.K., Felleisen, M.: A Syntactic Approach to Type Soundness. Information and Computation 115(1), 38–94 (1994)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2011 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Erdweg, S.T., Ostermann, K. (2011). Featherweight TeX and Parser Correctness. In: Malloy, B., Staab, S., van den Brand, M. (eds) Software Language Engineering. SLE 2010. Lecture Notes in Computer Science, vol 6563. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-19440-5_26

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-19440-5_26

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-19439-9

  • Online ISBN: 978-3-642-19440-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics