Devel::Tokenizer::C

Devel::Tokenizer::C is a Perl module that can generate C source for fast keyword tokenizer.
Download

Devel::Tokenizer::C Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Marcus Holland-Moritz
  • Publisher web site:
  • http://search.cpan.org/~mhx/Devel-PPPort-3.11/PPPort.pm

Devel::Tokenizer::C Tags


Devel::Tokenizer::C Description

Devel::Tokenizer::C is a Perl module that can generate C source for fast keyword tokenizer. Devel::Tokenizer::C is a Perl module that can generate C source for fast keyword tokenizer.SYNOPSIS use Devel::Tokenizer::C; $t = new Devel::Tokenizer::C TokenFunc => sub { "return U$_;n" }; $t->add_tokens(qw( bar baz ))->add_tokens(); $t->add_tokens(, 'defined DIRECTIVE'); print $t->generate;The Devel::Tokenizer::C module provides a small class for creating the essential ANSI C source code for a fast keyword tokenizer.The generated code is optimized for speed. On the ANSI-C keyword set, it's 2-3 times faster than equivalent code generated with the gprof utility.The above example would print the following C source code: switch (tokstr) { case 'b': switch (tokstr) { case 'a': switch (tokstr) { case 'r': if (tokstr == '') { /* bar */ return BAR; } goto unknown; case 'z': if (tokstr == '') { /* baz */ return BAZ; } goto unknown; default: goto unknown; } default: goto unknown; } case 'f': switch (tokstr) { case 'o': switch (tokstr) { #if defined DIRECTIVE case 'o': if (tokstr == '') { /* foo */ return FOO; } goto unknown; #endif /* defined DIRECTIVE */ case 'r': if (tokstr == '') { /* for */ return FOR; } goto unknown; default: goto unknown; } default: goto unknown; } default: goto unknown; }So the generated code only includes the main switch statement for the tokenizer. You can configure most of the generated code to fit for your application. Requirements: · Perl


Devel::Tokenizer::C Related Software