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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
NTS: A New Typesetting System, http://nts.tug.org/ (visited on 20.03.2010)
Badros, G.J., Notkin, D.: A Framework for Preprocessor-Aware C Source Code Analyses. Software: Practice and Experience 30(8), 907–924 (2000)
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)
Eijkhout, V.: TeX by Topic, A TeXnicans Reference. Addison-Wesley, Reading (1992)
Garrido, A., Johnson, R.: Refactoring C with Conditional Compilation. In: Automated Software Engineering, pp. 323–326. IEEE Computer Society, Los Alamitos (2003)
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)
Knuth, D.E.: The TeX Book. Addison-Wesley, Reading (1984)
Knuth, D.E.: TeX: The Program. Addison-Wesley, Reading (1986)
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)
Lamport, L.: LaTeX: A Document Preparation System. Addison-Wesley, Reading (1986)
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)
Livadas, P.E., Small, D.T.: Understanding Code Containing Preprocessor Constructs. In: Program Comprehension, pp. 89–97. IEEE Comp. Society, Los Alamitos (1994)
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)
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)
Weise, D., Crew, R.: Programmable Syntax Macros. In: Programming Language Design and Implementation, pp. 156–165. ACM, New York (1993)
Wright, A.K., Felleisen, M.: A Syntactic Approach to Type Soundness. Information and Computation 115(1), 38–94 (1994)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)