Compiler/Preprocessor: Difference between revisions
m
→{{header|Wren}}: Minor tidy
(→Task) |
m (→{{header|Wren}}: Minor tidy) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 61:
=={{header|Julia}}==
<
""" If the line is a macro definition, add the macro to macros. """
Line 201:
runwithopts(preprocess)
</
=={{header|Phix}}==
No attempt to implement command line arguments, obviously trivial on desktop/Phix but not possible under pwa/p2js, aka within a browser.
<!--<
<span style="color: #000080;font-style:italic;">--
-- demo\rosetta\Compiler\preprocess.exw
Line 381:
<span style="color: #000080;font-style:italic;">--close_files()</span>
<!--</
{{out}}
<pre>
Line 399:
=={{header|Python}}==
<
"""Rosetta Code compiler/preprocessor. Requires Python >= 3.7."""
import re
Line 742:
args = parser.parse_args()
preprocess(args.infile.read(), args.infile.name, args.outfile, debug=args.debug)
</syntaxhighlight>
{{out}}
Line 802:
Note that the program errors out if there are any syntax or other errors when defining the macros.
<
import "./ioutil" for FileUtil, File, Input
import "./str" for Char
Line 980:
file.writeBytes("\n")
}
}</
{{out}}
Using the example files;
<pre>
$ wren-cli
How many lines are to be entered? : 4
Line 1,025:
{{out}}
<pre>
$ wren-cli
Output:
|