0% found this document useful (0 votes)
132 views

Lua Regex On Parrot

François Perrad presented on implementing Lua regular expressions on Parrot. Lua regex is simple and small, defined in 2 pages of the reference manual and implemented in 400 lines of C code. It supports common features like character classes, quantifiers, anchors, captures, and backreferences. The Lua regex implementation was built by reusing and extending PGE::Exp from Parrot and registering it as a Lua compiler. It was tested with over 150 tests and aims to keep the implementation simple.

Uploaded by

Mikhail Miguel
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views

Lua Regex On Parrot

François Perrad presented on implementing Lua regular expressions on Parrot. Lua regex is simple and small, defined in 2 pages of the reference manual and implemented in 400 lines of C code. It supports common features like character classes, quantifiers, anchors, captures, and backreferences. The Lua regex implementation was built by reusing and extending PGE::Exp from Parrot and registering it as a Lua compiler. It was tested with over 150 tests and aims to keep the implementation simple.

Uploaded by

Mikhail Miguel
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Lua Regex on Parrot

Franois Perrad [email protected] PAUSE ID : PERRAD Parrot SVN : fperrad

(Lightning talk)

fperrad@FPW'08

Lua on Parrot

See my talk at FWP07 Why choose Lua

Prove the design goal : supports all dynamic languages Lua has advanced features

regex (with its own dialect) Grammar EBNF : 1 page Reference Manual < 100 pages
fperrad@FPW'08

Lua is small & simple


Lua Regex

Simple & small 2 pages in Ref. Manual 5.4.1 Implemented in C : 400 LoC Features Character class

., %a, %c, %d, %l, %p, %s, %u, %w, %x, %z, %A, enum & range[set], [^set] backref %1 %9 balanced %bxy : %b(), %b[]

Pattern item : *, +, -, ?

Anchors : ^, $ Captures : example "a*(.)%w(%s*)"


fperrad@FPW'08

Lua Regex on Parrot

Reused part of PGE::P5Regex

written by P. Michaud

Use and extend PGE::Exp Implemented in luaregex.pir


parse grammar emit PIR code

Registrered as a compiler LuaRegex Test Driven Development

150 tests
fperrad@FPW'08

Lua Regex

KISS

Keep It Simple Stupid

with Perl 5.10

use re::engine::Lua;

coming soon

fperrad@FPW'08

You might also like