[tug-summer-of-code] Simplifying TeX's \tracingall output

Will Robertson will at mecheng.adelaide.edu.au
Thu Feb 19 03:25:56 CET 2009


On 19/02/2009, at 12:55 PM, Will Robertson wrote:

> On 19/02/2009, at 9:01 AM, Jonathan Fine wrote:
>
>> It might be worth making this question part of a feasibility study  
>> - does TeX's tracing provide enough information to make this a  
>> worthwhile project, or do we need an extension.
>>
>> I'd quite like to know if anyone here is interested in (co)- 
>> mentoring a project on line such as this.  Interest from LaTeX3  
>> team members especially welcome.
>
> I'm not really sure what this has to do with the LaTeX3 project, to  
> be honest. It's impossible to influence the tracing from within TeX  
> itself, right? The only useful way to look at this (unless I've  
> missed something) is as a postprocessor to the log file.
>
> Here's a snippet of LaTeX3 code:
>
> ( \cs_set:Npn is TeX's \long\def, and \cs_set_nopar:Npn is TeX's  
> \def .)
>
>
>> \begingroup
>> \cs_set:Npn \tmp {\ERROR}
>> \tracingall
>> \tlp_set:co {l_tmpa_tlp} {\tmp}
>> \endgroup
>
> And here's the trace:
>
>> \tlp_set:co ->\exp_args:Nco \tlp_set:Nn
>>
>> \exp_args:Nco #1#2#3->\exp_after:NN #1\cs:w #2\exp_after:NN  
>> \cs_end: \exp_after
>> :NN {#3}
>> #1<-\tlp_set:Nn
>> #2<-l_tmpa_tlp
>> #3<-\tmp
>> {\expandafter}
>> {\csname}
>> {\expandafter}
>> {\expandafter}
>>
>> \tmp ->\ERROR
>>
>> \tlp_set:Nn #1#2->\cs_set_nopar:Npn #1{#2}
>> #1<-\l_tmpa_tlp
>> #2<-\ERROR
>> {\def}
>
> Here's how a more readable (to me) version might look:
>
>> \tlp_set:co {l_tmpa_tlp} {\tmp}
>> \exp_args:Nco \tlp_set:Nn {l_tmpa_tlp} {\tmp}
>> \exp_after:NN \tlp_set:Nn\cs:w l_tmpa_tlp\exp_after:NN \cs_end:  
>> \exp_after:NN {\tmp}
>
>> \tlp_set:Nn \l_tmpa_tlp {\ERROR}
>> \cs_set_nopar:Npn \l_tmpa_tlp {\ERROR}
>
>
> The problem is that this sort of transformation is only feasible (I  
> think) for small snippets of code. If you could somehow detect,  
> after tokenisation, where the "boundaries" of each piece of  
> expanding code existed (i.e., where the line breaks were,  
> originally) then the task might be more friendly. Although since  
> we're talking about post-processing, that should be perfectly  
> feasible as long as you've got access to the position in the source  
> file where the trace came from.
>
> Will

--
Will Robertson, Postgraduate student
<http://www.mecheng.adelaide.edu.au/~will/>

Acoustics, Vibration and Control Group
School of Mechanical Engineering
University of Adelaide, Australia



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2439 bytes
Desc: not available
Url : http://tug.org/pipermail/summer-of-code/attachments/20090219/717e4a4c/attachment.bin 


More information about the summer-of-code mailing list