WIP
[newfangle.git] / docs / examples / hello-world.tm
blob89d41c4e8a9f634aa87b57eeddf0c04f0f5e9aa9
1 <TeXmacs|1.0.7.10>
3 <style|<tuple|article|fangle>>
5 <\body>
6   <\hide-preamble>
7     <assign|par-first|0fn><assign|par-par-sep|0.5fn>
8   </hide-preamble>
10   <doc-data|<doc-title|Literate Example>|<doc-author-data|<author-name|Sam
11   Liddicott>|<\author-address>
12     sam@liddicott.com
13   </author-address>>>
15   <\abstract>
16     <\small>
17       This is a simple example of how to use literate programming templates,
18       using hello-world.
20       Hello-world is a famous <em|first program> with a visible side effect.
22       This example produces hello-world in multiple languages.
23     </small>
24   </abstract>
26   <\table-of-contents|toc>
27   </table-of-contents>
29   <section|Hello World>
31   The typical hello world program looks like this:
33   <\nf-chunk|hello-world>
34     <item>/* The traditional hello-world program in <nf-arg|language>\ 
36     <item> * generated using fangle literate programming macros
38     <item> */
40     <item>
42     <item>#include stdio.c
44     <item>
46     <item>main() {
48     <item> \ printf("<nf-arg|message>\\n");
50     <item>}
51   </nf-chunk||<tuple|message|language>>
53   <subsection|In French>
55   \;
57   We will derive the french hello-world program like this:
59   <\nf-chunk|./hello-world.fr.c>
60     <item><nf-ref|hello-world|<tuple|Bonjour tout le monde|french>>
61   </nf-chunk||>
63   <subsection|In German>
65   We will derive the german hello-world program like this:
67   <\nf-chunk|./hello-world.de.c>
68     <item><nf-ref|hello-world|<tuple|Hallo welt|german>>
69   </nf-chunk||>
70 </body>
72 <\references>
73 </references>
75 <\auxiliary>
76 </auxiliary>