[Dev-luatex] Extension language integration of LuaTeX and LilyPond

Hans Hagen pragma at wxs.nl
Tue May 7 19:21:44 CEST 2013

```On 5/7/2013 1:13 PM, David Kastrup wrote:
>
> Hi,
>
> at the recent BachoTeX conference, I held a talk comparing LuaTeX and
> LilyPond integration of their respective extension languages.  Now the
> talk slot was just 30 minutes, so the talk was quite more condensed than
> the proceedings, and I probably would have had to take the laptop away
> from Hans to have the talk make much of an impression anyway (not that
> there would have been much of a talk if people had locked _my_ laptop
> away in the days before it) and that still would not have given me a
> hook into Taco who had to miss out on BachoTeX because of anniversative
> conditions.
>
> So I am instead dumping the PDF of the proceedings on this list as it
> may inspire people to try working on some more user-manageable low-level
> interaction between Lua and TeX than the current situation provides.
> I've added some rough sketches at the end of the article that should
> make clear why this can't be done in formats alone but will require
> primitive support as well if things are supposed to turn out nicely.
>
> Hope you can make something of it.

in cases where you use tex as processsing engine one can avoid most tex
and especially nasty parsing by just keeping the tricky stuff at the lua
end or in the case of lilypond at the lisp end: just avoid parsing at
the tex end and spit out predictable tex code ... no user is going to
see it

i'm not so sure if messing with the input parser helps out ... and any
special treatment of for instance \directlua's argument would slow down
and for sure break already present code; there are some helpers (like
\luaescapestring) and one can do catcode juggling as well as detokenize
but in the end, \directlua is just a predictable simple and efficient
interface

another option is to parse the input files (after all there is a
callback for it) and do some preprocessing

at some point taco and i discussed a tex primitive that would sort of
map more directly onto a function for instance by (optionally) avoiding
tokenization (if possible)

but it's all very low priority stuff compared to other pending (opening
up) issues and more something for > 1.00

Hans

-----------------------------------------------------------------