C1R Implementation: Difference between revisions

no edit summary
m (Add numeric symbols for nbsp to sed command)
imported>Katsumi
No edit summary
 
(One intermediate revision by one other user not shown)
Line 5:
The "Quine" task required special treatment.
 
<langsyntaxhighlight clang="bash">#! /bin/bash
 
# C1R compiler
Line 17:
# unescape HTML codes: replace "&lt;" by "<" etc
function unescapeHTML() {
sed -e 's/&lt\;/</g;s/&gt\;/>/g;s/&nbsp\;/ /g;;s/&#160\;/ /g;s/&#xA0\;/ /g;s/&quot\;/"/g;s/&#40\;/(/g;s/&#41\;/)/g;s/&#91\;/[/g;s/&#93\;/]/g;s/&#123\;/{/g;s/&#125\;/}/g'
}
 
Line 50:
 
cc $FILENAME1
</syntaxhighlight>
</lang>
 
A typical test session would look like:
<langsyntaxhighlight lang="bash">
$ echo Hello_world/Text >hw.c1r
$ ./c1r hw.c1r
$ ./a.out
Goodbye, World!
</syntaxhighlight>
</lang>
Anonymous user