Parse::Yapp

Parse::Yapp is a Perl extension for generating and using LALR parsers.
Download

Parse::Yapp Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Francois Desarmenien
  • Publisher web site:
  • http://search.cpan.org/~fdesar/Parse-Yapp-1.05/lib/Parse/Yapp.pm

Parse::Yapp Tags


Parse::Yapp Description

Parse::Yapp is a Perl extension for generating and using LALR parsers. Parse::Yapp is a Perl extension for generating and using LALR parsers.SYNOPSIS yapp -m MyParser grammar_file.yp ... use MyParser; $parser=new MyParser(); $value=$parser->YYParse(yylex => &lexer_sub, yyerror => &error_sub); $nberr=$parser->YYNberr(); $parser->YYData->{DATA}= ; $data=$parser->YYData->{DATA};Parse::Yapp (Yet Another Perl Parser compiler) is a collection of modules that let you generate and use yacc like thread safe (reentrant) parsers with perl object oriented interface.The script yapp is a front-end to the Parse::Yapp module and let you easily create a Perl OO parser from an input grammar file.The Grammar fileCommentsThrough all your files, comments are either Perl style, introduced by # up to the end of line, or C style, enclosed between /* and */.Tokens and string literalsThrough all the grammar files, two kind of symbols may appear: Non-terminal symbols, called also left-hand-side symbols, which are the names of your rules, and Terminal symbols, called also Tokens.Tokens are the symbols your lexer function will feed your parser with (see below). They are of two flavours: symbolic tokens and string literals.Non-terminals and symbolic tokens share the same identifier syntax: *String literals are enclosed in single quotes and can contain almost anything. They will be output to your parser file double-quoted, making any special character as such. '"', '$' and '@' will be automatically quoted with '', making their writing more natural. On the other hand, if you need a single quote inside your literal, just quote it with ''.You cannot have a literal 'error' in your grammar as it would confuse the driver with the error token. Use a symbolic token instead. In case you inadvertently use it, this will produce a warning telling you you should have written it error and will treat it as if it were the error token, which is certainly NOT what you meant.Grammar file syntaxIt is very close to yacc syntax (in fact, Parse::Yapp should compile a clean yacc grammar without any modification, whereas the opposite is not true). Requirements: · Perl


Parse::Yapp Related Software