README.lufy 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. License-related comments about the files here.
  2. The file "lufy.red" is made by applying a series of mechanical
  3. transformations starting from tex.web, which is the Original Knuth
  4. literate form of the TeX program source. The exact details of these
  5. transformations are documented precisely by the code here, but clearly
  6. many people will consider lightly commented code not to be as clear
  7. an explanation as would be desirable even if it is (by definition)
  8. pretty complete.
  9. p2l.l is the flex input that defines a Pascal-compatible lexical analyser.
  10. p2l.ypp is a bison input file describing a Pascal parser. I added semantic
  11. actions to an existing grammar so that some form of parse tree gets
  12. created. Each individual semantic action should be simple enough to
  13. understand.
  14. p2l.cpp contains two segments of code. One lot is a set of constructors
  15. for parse tree nodes, which are built in a really naive manner. The
  16. second is code that traverses a parse tree printing it in a fully
  17. parenthesised notation that will be acceptible to a Lisp system.
  18. The code in all the above is supposed to preserve all information present
  19. in Pascal source (which is itself obtained by using "tangle" in tex.web).
  20. p2l.red is Reduce code that reads in the parenthesised parse tree and
  21. rearranges it so that it ends up as something rather like executable
  22. Lisp code. In doing this it discards Pascal type information, but in
  23. general it is mostly just performing fairly direct re-writes of the
  24. structure of the tree. For instance in the bison parser most lists are
  25. accumulated in a left-associated form, as in (((a b) c) d), and p2l.red
  26. will typically change that to be (a b c d). It also normalises the names
  27. at the head of segments of the parse tree to match function names in
  28. the Standards Lisp that Reduce uses. The output from p2l.red is lufy.red.
  29. A number of Pascal features do not translate into Lisp very easily, and so
  30. the code in lufy.red is not directly usable. To make it possible to run it
  31. a prolog file is provided that defines some of the functions present in
  32. in in a way that is compatible with native Lisp, and then flags the names
  33. of those functions as 'LOSE. That is a Reduce feature which permits the
  34. definition from the prolog to take the place on the one in lufy.red.
  35. As regards the rights associated with the TeX source, lufy.red is clearly
  36. derived from tex.web, but its name is not anything that can be readily
  37. confused with TeX and that should satisfy the requirements of the Knuth
  38. License. The detailed documentation of how it is derived available by
  39. inspecting the code used to make it, and the fact that a prolog file of
  40. overrides is used rather than hand editing of the transformed file are
  41. schemes intended to fit in with the spirit as well as the letter of TeXs
  42. requirements.