Language::Zcode::Parser - reads and parses a Z-code file into a big Perl hash
# Create a Pure Perl Parser my $pParser = new Language::Zcode::Parser "Perl"; # If they didn't put ".z5" at the end, find it anyway $infile = $pParser->find_zfile($infile) || exit; # Read in the file, store it in memory $pParser->read_memory($infile); # Parse header of the Z-file $pParser->parse_header(); # Get the subroutines in the file (LZ::Parser::Routine objects) my @subs = $pParser->find_subs($infile);
For finding where the subroutines start and end, you can either depend on an external call to txd, a 1992 C program available at ifarchive.org, or a pure Perl version.
Everything else is done in pure Perl.
This is a factory method. Called with 'Perl' or 'TXD' (or 'txd') as arguments, it will create Parsers of LZ::Parser::Perl or LZ::Parser::TXD, which are subclasses of LZ::Parser::Generic.
That class' 'new' method will be called with any other passed-in args.
To install Language::Zcode, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Language::Zcode
CPAN shell
perl -MCPAN -e shell install Language::Zcode
For more information on module installation, please visit the detailed CPAN module installation guide.