Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular Expressions and Assembly

I know 8086 Assembly and learning MIPS Assembly. Also, I'm learning Regular Expressions, then I want to know:

  • How can I use Regular Expressions on them?
like image 536
Nathan Campos Avatar asked Jan 31 '10 16:01

Nathan Campos


2 Answers

This is a challenging problem to pull off in assembly from scratch. No assembly language would support regular expressions as a first-class construct because there's too much of a difference in the abstraction level to make it a useful inclusion. That means you need to build it yourself.

Supporting regular expressions is essentially like having a compiler inside your program that translates the expression into a sequence of matching instructions. You will have to build all of the constituent pieces: a translation engine, a series of transformation rules, a DFA assembler, and a matching engine.

That said, it's not impossible! Start small, supporting tiny subsets of the real language you want to support, and then work your way up. Check out chapter 16 of Assembly Language Programming for a detailed walkthrough of how you might build your own regular expression engine. You'll need a good understanding of how they work (which this chapter will give you) and a solid understanding of assembly as well (see the earlier chapters for that).

like image 53
John Feminella Avatar answered Oct 11 '22 00:10

John Feminella


Try this: AsmRegEx - regular expression engine

It's written in FASM. Unfortunately, it seems that the project won't progress anymore...

like image 35
anta40 Avatar answered Oct 11 '22 01:10

anta40