Pyrl synthax
It's simple! It's just like Perl, with the difference that there are no "{" or "}" brackets and no ";" (semicolons).
Blocks are determined by indentation alone, much like in Python (which is why it's called Pyrl.. Python & Perl)
I'm not making a claim that it's very Pythonish, the only similarity is that
indentation decides blocks.
Note about comments: You have to have at least two spaces or at least one tab before a "#" comment. This is because I'm so lazy
at coding that I didn't come up with a better solution for not matching "#"'s in the middle of the code as comments.
Important, you should use an editor you can trust, that doesn't throw in spaces or tabs at will. If
a space is missing it could mean a total difference in program execution. Use tabs all the way, thats my
recommendation.
Comparsion, plain Perl vs. Pyrl:
In Perl:
if ($bla) {
print "Yadayada: $bla\n";
$a = 5;
}
print "more bogus text";
and in Pyrl:
if ($bla)
print "Yadayada: $bla\n"
$a = 5
print "more bogus text"
By putting a "{" alone on a row, you indicate that here follows 'pure' Perl code that shouldn't be
messed with, the block is finished with a "}" on it's own row:
if ($a)
print "hello!\n"
{
print "this code won't be messed with," .
" get the difference?";
if ($perl_rules_the_world_you_have_to_type_all_this) {
print "ok\n";
}
}
which after 'translation' would become:
if ($a) {
print "hello!\n";
}
print "this code won't be messed with," .
" get the difference?";
if ($perl_rules_the_world_you_have_to_type_all_this) {
print "ok\n";
}
This can be useful for when using the print <<EOF construct, because otherwise
pyrl would look at all the indents of the "string lines" after and think of that as code.
Visit the Cython/Pyrl webpage: www.algonet.se/~jsjogren/oscar/cython/
Mail (bugs to) Oscar Campbell: oscar@linux.nu
Copyright (c) 2000, Oscar Campbell