Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.224.43.85
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/doc/libparse-recdescent-perl/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/doc/libparse-recdescent-perl/examples/demo_lisplike.pl
#!/usr/bin/perl -w

use Parse::RecDescent;
use Data::Dumper;

my $grammar = q{

        s_expr: '(' s_expr(s) ')'               # NESTED S-EXPRS
                        { $return = $item[2] }
              | /" [^\\"]* (\\. [^\\"]*)* "/x   # STRINGS
              | /[^()\s]+/                      # ANYTHING ELSE


};

my $parser = Parse::RecDescent->new($grammar) or die;

undef $/;
my $data = <DATA>;

my $nested_array = $parser->s_expr($data);


print Data::Dumper->Dump($nested_array);

__DATA__

     (net
       (rename VDDTX "vddtx")
       (joined
	 (portRef VDDTX)
	 (portRef &2
	   (instanceRef I_45_1102680350)))
       (figure WIRE
	 (path
	   (pointList
	     (pt 6700 -2100)
	     (pt 6900 -2100)))
	 (path
	   (pointList
	     (pt 6900 -2100)
	     (pt 6900 -2500)))))
     (net
       (rename N00023 "N00023")
       (joined
	 (portRef &2
	   (instanceRef I_45_1215476478))
	 (portRef &1
	   (instanceRef I_45_1102680350))
	 (portRef &2
	   (instanceRef I_45_1215470655)))
       (figure WIRE
	 (path
	   (pointList
	     (pt 5800 -3400)
	     (pt 6900 -3400)))
	 (path
	   (pointList
	     (pt 5800 -3400)
	     (pt 5800 -3700)))
	 (path
	   (pointList
	     (pt 6900 -3100)
	     (pt 6900 -3400)))
	 (path
	   (pointList
	     (pt 8000 -3400)
	     (pt 8000 -3700)))
	 (path
	   (pointList
	     (pt 6900 -3400)
	     (pt 8000 -3400))))
       (instance
	 (rename TIE1 "TIE1")
	 (viewRef XTIE0A2Y2
	   (cellRef XTIE0A2Y2
	     (libraryRef RIPPER_LIBRARY)))
	 (transform
	   (origin
	     (pt 6900 -3400)))))


Anon7 - 2022
AnonSec Team