Talk:Compiler/Simple file inclusion pre processor: Difference between revisions

m
formating
m (formating)
Line 40:
:::Also, I doubt that a C pre-processor written in anything but C would get much use for anything other than bootstrapping... --[[User:Tigerofdarkness|Tigerofdarkness]] ([[User talk:Tigerofdarkness|talk]]) 21:42, 6 June 2021 (UTC)
I believe our sample language could use one line: #include "file" and #define call value. Usage could be:
<pre>
 
~~ Header.h ~~
#define area(h, w) h*w
Line 49:
#define height() 6
area = #area(height, width)#;
</pre>
 
yielding code output of:
<pre>
 
area = 6*5;
</pre>
 
Or:
<pre>
 
/* Include Header.h */
/* Define area(h, w) as h*w */
Line 63:
/* Use area, height, and width */
area = 6*5;
</pre>
 
This should be in addition to the existing preprocessor definition as both are useful demonstrations. This new one providing identical language support to our sample language in multiple source languages.