Misc
Generated on 2024-11-21 Contact
|
Perl tricksCipher Brain has developped some expertise in Perl, and has notes here on some points which where not trivial, and for which documentation was not found easily. Use of pbyaccYacc, and its GNU replacement Bison is a parser generator, i.e. a program to generate some routines which can parse some text and data according to a user-specified grammar. The basic Yacc documentation is availlable on the net, or with man yacc. We detail here only some point. yylexThe method yyparse of the object generated by pbyacc takes one argument, which is passed to the function yylex. The function yylex should return one of:
Note that the same argument of yyparse is given as the second argument of yyerror if it is called, the first argument being an error message. The only two usages of the argument of yyparse are for calling yylex and yyerror, which are written by the user. Therefore, anything can be given: nothing (i.e. undef), a string, an object (like a stream handle,...) or a hash or list reference, to be able to simulate passing more than one value. |