Can I separately run VCC Compiler to peek into its output?

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Jan 31 19:55:27 UTC 2018


--------
In message <CAOssFL4yxCA2=iL_G=xjEZzPPAiNhgs37HA+Yihy69w=r8hMWg at mail.gmail.com>, Arvind Narayanan writes:

>I am trying to understand your source code, more specifically in
>understanding what kind of files are generated by the VCC compiler.

Use the -C argument, and varnishd emits the C source for you to look at.

It's not so much a compiler as a translator.

Struture wise it's very simple:

First it converts the source file into a list of tokens.

There's a "half-pass" where any "include filename" constructs
in the token-list gets expanded.

And then it walks the list from end to other, and spitting out
"dot-h" and a "dot-c" streams, which are then concatenated and sent
to the C-compiler.

Comments, observations, suggestoins and wisdom is most welcome :-)

Poul-Henning

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the varnish-misc mailing list