Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    Devel::Tokenizer::C 0.08

    Download button

    No screenshots available
    Downloads: 414  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Marcus Holland-Moritz | More programs
    Perl Artistic License / FREE
    July 6th, 2006, 15:30 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Devel::Tokenizer::C description

    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$_[0];n" };

    $t->add_tokens(qw( bar baz ))->add_tokens(['for']);
    $t->add_tokens([qw( foo )], '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[0])
    {
    case 'b':
    switch (tokstr[1])
    {
    case 'a':
    switch (tokstr[2])
    {
    case 'r':
    if (tokstr[3] == '�')
    { /* bar */
    return BAR;
    }

    goto unknown;

    case 'z':
    if (tokstr[3] == '�')
    { /* baz */
    return BAZ;
    }

    goto unknown;

    default:
    goto unknown;
    }

    default:
    goto unknown;
    }

    case 'f':
    switch (tokstr[1])
    {
    case 'o':
    switch (tokstr[2])
    {
    #if defined DIRECTIVE
    case 'o':
    if (tokstr[3] == '�')
    { /* foo */
    return FOO;
    }

    goto unknown;
    #endif /* defined DIRECTIVE */

    case 'r':
    if (tokstr[3] == '�')
    { /* 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.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    generate C source | keyword tokenizer | Perl module | module | generate | C

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM