On 5/28/13 5:53pm, luigi scarso wrote:
On Tue, May 28, 2013 at 3:04 PM, Sensei <[email protected] <mailto:[email protected]>> wrote: Pardon me, but I'm used to write code in C, assembly, C++, or whatever other programming language (mainly those three, in that order). TeX is very, very different. Another option is to download the source of luatex, compile it with the --debug switch and then run luatex with gdb. Probably (not evidently nor obviously) you need a format: you can install a context standalone which has a plain fmt easy to build. TeX is a procedural markup language where everything, even a character, is a procedure (or macro ), luatex, pdftex,xetex,etex are interpreters of TeX with some differences on the languages accepted, but basically they all are Syntax-Directed Interpreters: a big switch/case inside a while that dispatches the tokens from the lexer to the right subroutines (iirc it's called main_control in maincontrol.w, the cweb file).
That's interesting.
The main difference from others similar languages probably is the fact that the user can modify the meaning of the tokens, more or less as if were able to modify the keywords of C --- so TeX is a kind of meta SDI ; also it's carefully designed to be platform independent (but as say previously you should see http://www.tug.org/texinfohtml/web2c.html#Memory-dumps) With a debugged version of luatex , the plain format from standalone and test.tex like Hello\bye you can see TeX in action running gdb with luatex --fmt=luatex-plain.fmt test.tex
Thanks Luigi, the fact that I can modify everything is new (no other programming language does that at this level, iirc).
I moved to read the TeX book, maybe that clarifies a lot. Cheers
