The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Parse::Highlife - Perl extension for grammar based parsing and transformation of data.

SYNOPSIS

  use Parse::Highlife;
  
  # define grammar (grammar for DEC format as an example)
	my $grammar = q{
		space ignored: /\s\n\r\t+/;
		multiline-comment ignored: "/*" .. "*/";
		singleline-comment ignored: /\#[^\n\r]*/;
		file: { declaration 0..* };	
			declaration: [ "@" identifier ] literal;
				literal: < map string real number identifier >;
					map: [ symbol ] "[" { pair 0..* } "]";
						pair: [ symbol ":" ] declaration;
					string: < double-quoted-string single-quoted-string >;
						double-quoted-string: '"' .. '"';
						single-quoted-string: "'" .. "'";
					real: /\d+\.\d+/;
					number: /\d+/;
					identifier: symbol { "." symbol 0..* };
						symbol: /[\w\d]+(\-[\w\d]+)*/;
	};
  
	# setup compiler
	my $compiler = Parse::Highlife -> Compiler;
	$compiler->grammar( $Grammar );
	$compiler->toprule( -name => 'file' );
  
	# compile document
	$compiler -> compile( 'myfile.txt' );

DESCRIPTION

Parse::Highlife is used to parse and transform string data. You can define a grammar and a tokenizer, parser and transformer are generated. By defining transformers for some you non-terminals.

This documentation is incomplete and will be expanded soon.

EXPORT

coming soon.

SEE ALSO

None.

AUTHOR

Tom Kirchner, <tom@kirchner.com>

COPYRIGHT AND LICENSE

Copyright (C) 2012 by Tom Kirchner

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.