lisp on t ex
play

LISP on T EX Comparison A LISP Interpreter Written Using T EX - PowerPoint PPT Presentation

LISP on T EX S. HAKUTA Introduction Goal and Mean LISP on TeX LISP on T EX Comparison A LISP Interpreter Written Using T EX Macros Conclusion HAKUTA Shizuya The 34th Annual Meeting of the TeX Users Group, 2013 Background LISP on T EX


  1. LISP on T EX S. HAKUTA Introduction Goal and Mean LISP on TeX LISP on T EX Comparison A LISP Interpreter Written Using T EX Macros Conclusion HAKUTA Shizuya The 34th Annual Meeting of the TeX Users Group, 2013

  2. Background LISP on T EX S. HAKUTA Introduction Goal and Mean LISP on TeX Writing T EX macros is useful. Comparison e.g. Calculating some small numeric expressions. Conclusion However, it is difficult for novice users. To improve, there are some researches that combine T EX and another programming language.

  3. T EX with Other Languages LISP on T EX S. HAKUTA Pakin[TUGboat ’03] showed four way to connect T EX and a Introduction foreign programing language; Goal and Mean LISP on TeX 1 using \write18 to call an outer processor, Comparison python package (CTAN:macros/latex/contrib/python) Conclusion 2 embedding an interpreter in a T EX engine, LuaT EX (CTAN:systems/luatex) 3 constructing macros that enable L A T EX to communicate with an external interpreter, PerlT EX (CTAN:macros/latex/conrtib/perltex) 4 creating a language processor with T EX macros L A T EX3 project created expl3: a new interface of T EX macros, but no ordinary language was implemented.

  4. The Goal and the Mean LISP on T EX S. HAKUTA Introduction Goal and Mean Our goals are LISP on TeX Comparison Implementing a language’s interpreter with T EX macros, and Conclusion Comparing its performance with other approaches. We take two design choices; 1 Choosing LISP as a ordinary language, and 2 Creating the product as a LaTeX package.

  5. LISP on T EX LISP on T EX S. HAKUTA Introduction We name the our product LISP on T EX. Goal and Mean LISP on TeX It was already archived on CTAN and T EXLive. Comparison macros/latex/contrib/lisp-on-tex Conclusion We constructed all parts of LISP on T EX with T EX macros; parser, recognizing LISP expressions, evaluator, calculating a expression, and environment, mapping symbols to LISP objects. The code is written with traditional TeX macros only, so it works in all L A T EX engines, L A T EX, pdfL A T EX, LuaL A T EX, XeL A T EX, pL A T EX, . . .

  6. Examples (1/2) LISP on T EX Source S. HAKUTA The Preamble of the Slides Introduction \usepackage{lisp-on-tex} Goal and Mean LISP on TeX \lispinterp{ Comparison (\define \fact Conclusion (\lambda (\n) (\lispif (\= \n :0) :1 (\* (\fact (\- \n :1)) \n))))} Result $10!=\lispinterp{(\texprint(\fact:10))}$

  7. Examples (1/2) LISP on T EX Source S. HAKUTA The Preamble of the Slides Introduction \usepackage{lisp-on-tex} Goal and Mean LISP on TeX \lispinterp{ Comparison (\define \fact Conclusion (\lambda (\n) (\lispif (\= \n :0) :1 (\* (\fact (\- \n :1)) \n))))} Result 10 ! = 3628800

  8. Examples (1/2) LISP on T EX Source S. HAKUTA The Preamble of the Slides Introduction \usepackage{lisp-on-tex} Goal and Mean LISP on TeX \lispinterp{ Comparison (\define \fact Conclusion (\lambda (\n) (\lispif (\= \n :0) :1 (\* (\fact (\- \n :1)) \n))))} Result 10 ! = 3628800 LISP codes were evaluated!

  9. Examples (2/2) LISP on T EX S. HAKUTA Introduction Goal and Mean LISP on TeX Comparison Conclusion

  10. Examples (2/2) LISP on T EX S. HAKUTA Introduction Goal and Mean LISP on TeX Comparison Conclusion

  11. Memory Management Problems LISP on T EX S. HAKUTA Introduction Goal and Mean LISP on TeX LISP on T EX uses a lot of memory. Comparison Yato showed that LISP on T EX stalls when using a lot of LISP Conclusion objects 1 . It is caused by spending a lot of control sequences. Building a garbage collection system is one of our future work. 1 http://d.hatena.ne.jp/zrbabbler/20121116/1353068217 (Japanese Only)

  12. Comparison to other approaches LISP on T EX S. HAKUTA We compared LISP on T EX and other approaches by three benchmarks. Introduction Goal and Mean CPU Core i7 2.2GHz, 8GByte Memory, W32TeX LISP on TeX Comparison tarai[sec] asterisks[sec] Mandelbrot[sec] Conclusion 1 . 6 × 10 2 2 . 1 × 10 4 LISP on T EX 13 1 . 6 × 10 2 PerlT EX 1.0 1.0 LuaT EX 0.45 0.55 7.6 1 . 2 × 10 2 T EX macros 0.24 0.22 5 . 7 × 10 3 expl3 1.1 1.0 It shows that LISP on T EX is too slow... :-( It is caused by reading T EX tokens repeatedly. ⇒ We can make LISP on T EX faster with improving the code.

  13. Conclusion LISP on T EX S. HAKUTA Introduction Goal and Mean LISP on TeX Comparison We implemented LISP on T EX, a LISP interpreter written only Conclusion with T EX macros. It works well, but the product has problems about memory usage and speed.

  14. Why LISP is Selected? LISP on T EX S. HAKUTA Introduction Goal and Mean LISP on TeX Comparison There are two reasons why we select LISP . Conclusion 1 LISP is Turing complete, so it contains all essence of programming languages. 2 Because LISP has simple syntax and semantics, we can implement LISP easily.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend