yeah, it's lua. I implemented a simple regular expression engine in lua. Writing a regex parser is kind of annoying, and I think I'm going to get by with manually constructing the epsilon nfa with function calls, and then calling conversion functions to get it to an nfa. It is pretty slow at the moment though. I need to convert the nfa to a dfa now.
But this made me think though, what if regular expressions were represented as syntax trees? Would they be any more readable?
/[A-Za-z_][A-Za-z0-9_]*/
or
(regex (concat (union (range A Z)
(range a z)
_)
(zero-or-more (union (range A Z)
(range a z)
(range 0 9)
_))))
or maybe stack based?
/A /Z range /a /z range union /_ union
/A /Z range /a /z range union /0 /9 range union /_ union zero-or-more
concat
>>6
LispBot? >>7
AntiLispBot?
The first one posts something about Lisp superiority, then 1-5 minute delay and "Lisp is shit" bot chimes in
Name:
Anonymous2011-11-17 3:53
>>8
Back in the days of fanfold, there was a type of programmer who would only put five or ten lines of code on a page, preceded by twenty lines of elaborately formatted comments. Object-oriented programming is like crack for these people: it lets you incorporate all this scaffolding right into your source code. So it is a good tool if you want to convince yourself, or someone else, that you are doing a lot of work. -- Paul Graham