Execute Brain****/Perl: Difference between revisions

m
Fixed syntax highlighting.
m (<lang>)
m (Fixed syntax highlighting.)
 
(2 intermediate revisions by 2 users not shown)
Line 1:
{{implementation|Brainf***}}{{collection|RCBF}}[[Category:Perl]]
This is a simple non-optimizing and non-optimized interpreter that is written in [[Perl]]. To run a program, give the name of its file as an argument to the interpreter. If you don't provide an argument, the program will be read from standard input.
 
You can set your own values for the standard nonstandardized behaviors (like the value "," returns on EOF) by changing the variables listed under "Implementation-specific variables". The other nonstandardized aspects of the language are allowed to follow Perl's defaults: for instance, modifying a cell past the forward end of the tape will lengthen it, but going backward from the first cell will wrap around to the final cell. These could be made somewhat more sensible, but doing so would serve little purpose, as this interpreter is meant to serve as a simple example, not an industrial-strength tool.
 
<langsyntaxhighlight lang="perl">#!/usr/bin/perl
 
use strict;
Line 85:
# We simply ignore meaningless characters.
++$cmd;
$cmd < @code or last;}</syntaxhighlight>
</lang>
9,476

edits