Talk:String rewriting paradigm
Jump to navigation
Jump to search
Very Misnamed?
I'm not sure that this is a string-rewriting paradigm language at all. It seems to simply append characters from a stack or insert characters, so it's a character output only stack-based language with no control flow other than infinite looping? There is no way to specify an arbitrary rewrite rule like the currently featured language Thue. The most rewrite like aspect is [C] => [C][C], but it looks like it is meant to be processed sequentially as a result of the imperative command d
, rather than being a rule. I also don't quite see how the looping counter code !@:
loops unless the output from :
is appended to the program, and then I don't see how it counts. I accidentally an interpreter in Perl. Salpynx (talk) 23:26, 17 March 2019 (UTC)
#!/usr/bin/perl use strict; use warnings; # Character Output Without Claimed Rewrite Paradigm Parser: foreach(<STDIN>) { my $i = 0; my $stack; chomp; while ($i < length) { # [C] are appended # no rewriting happening s/^(.{$i}d)(.)/$1$2$2/; # even though this is a substitution, it is only inserting chars $stack .= $1 if /^.{$i}!.*(.)$/; $_ .= chop $stack if /^(.{$i})\@/; $_ .= $1 if /^(.{$i}):/; print; print " (" . $i++ . ")\n"; } }