473,513 Members | 2,576 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Interperter pattern for regular expression

Dear all,

I was looking for a c++ implementation of regular expressions using
the Interpreter Design Pattern. GOF only references a Smaltalk
implementation which I can not read :(.

Does anyone know a link besides the cuj january 2003 article ('A
Different Interpretation of the Interpreter Design Pattern'). I am
especially stuck with the context object, since all these regular
expression operators seems to generate different possible input
states.

Wkr,
me

May 21 '07 #1
3 2327
* ga*****@hotmail.com:
Dear all,

I was looking for a c++ implementation of regular expressions using
the Interpreter Design Pattern. GOF only references a Smaltalk
implementation which I can not read :(.
Figuring out what you're asking about took some Googling. A trivial
concept with a misleading name. The point of patterns was to name them
authoritatively so we could all know what others are talking about or at
least look it up in a few mouse-clicks, but either it didn't turn out
that way, or I'm atypical, not a compulsive pattern name memorizer.
Hah, I remember the name Visitor, because it's so often necessary
provide just the name in explanations to newbies. Anyway, I think it
would have been better if you simply described the problem.

Does anyone know a link besides the cuj january 2003 article ('A
Different Interpretation of the Interpreter Design Pattern'). I am
especially stuck with the context object, since all these regular
expression operators seems to generate different possible input
states.
Don't know if this is different or the same (since /you/ don't provide a
link), but look up <url:
http://research.microsoft.com/projects/greta/regex_perf.html>, which I
found by Googling.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
May 22 '07 #2
* ga*****@hotmail.com:
On 22 mei, 05:01, "Alf P. Steinbach" <a...@start.nowrote:
>>I was looking for a c++ implementation of regular expressions using
the Interpreter Design Pattern. GOF only references a Smaltalk
implementation which I can not read :(.
Figuring out what you're asking about took some Googling. A trivial
concept with a misleading name.
I do not understand this. The classical book 'Desgin Patterns'
contains a complete section of their 'Interpreter' pattern with a
boolean expression example (in c++) and a regular expression case (in
Smaltalk).
Please reply in the newsgroup, not by private e-mail (unless of course
for personal communication).

This reply posted to the newsgroup and CC'ed to you.

I don't have the Design Patterns book in my bookshelf. I read the book
when it was published. In addition to the Design Pattern book it's also
a good idea to read at last one anti-Pattern book.

>Don't know if this is different or the same (since /you/ don't provide a
link), but look up <url:http://research.microsoft.com/projects/greta/regex_perf.html>, which I
found by Googling.
It's the same author, but reverse engineering GRETA would be as much
work as learning Smaltalk...
Why do you need to reverse-engineer?

What's the problem?

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
May 22 '07 #3
On 22 mei, 09:51, "Alf P. Steinbach" <a...@start.nowrote:
* gast...@hotmail.com:
On 22 mei, 05:01, "Alf P. Steinbach" <a...@start.nowrote:
>I was looking for a c++ implementation of regular expressions using
the Interpreter Design Pattern. GOF only references a Smaltalk
implementation which I can not read :(.
Figuring out what you're asking about took some Googling. A trivial
concept with a misleading name.
I do not understand this. The classical book 'Desgin Patterns'
contains a complete section of their 'Interpreter' pattern with a
boolean expression example (in c++) and a regular expression case (in
Smaltalk).

Please reply in the newsgroup, not by private e-mail (unless of course
for personal communication).
Sorry that was the wrong link I clicked on.
>
I don't have the Design Patterns book in my bookshelf. I read the book
when it was published. In addition to the Design Pattern book it's also
a good idea to read at last one anti-Pattern book.
That is a totally different subject. I do not want to open a
discussion on patterns.
Don't know if this is different or the same (since /you/ don't provide a
link), but look up <url:http://research.microsoft.com/projects/greta/regex_perf.html>, which I
found by Googling.
It's the same author, but reverse engineering GRETA would be as much
work as learning Smaltalk...

Why do you need to reverse-engineer?

What's the problem?
So my original question still stands. In the meantime I am designing
it myself, so maybe I do not need a c++ implementation to copy from.

May 22 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1266
by: Eli | last post by:
Hi, I've followed the Python docs about extending the Python interperter and created an extension library. I've added my functions like this: static PyMethodDef pmylib_methods = { {"foo", pmylib_foo, METH_VARARGS, "foo() doc string"}, .... } static PyObject *pmylib_foo(PyObject *self, PyObject *args)
2
3413
by: Johann Sijpkes | last post by:
Hi, Just before going mad I thought asking this newsgroup would be a good idea. I want to validate dates using a schema but somehow the regexp is not performed by the validator? (at w3c..). I have a small regular expression which works fine, but the long beast just validates. Also on invalid dates like 35/07/04 (dd/mm/yy). Anyway, in the...
1
1684
by: Jeff | last post by:
For the life of me, I can't create a working regular expression for a schema pattern to do the following: Validates if an entire word does NOT match the entire word in the pattern. For example, in the pattern the word my be "foo". If the word "foo" is in my XML it should fail. If any other word, such as "cat" or "foot" or "barfoo" is in...
5
2175
by: Abby Lee | last post by:
I ask the user to enter a time in the formatio 12:30 PM. onChange I send the string to this function. I'm using alert boxes to test it...and am always getting the "Does not work" alert box. What am I doing wrong? function checkTime(pattern){ if(pattern.value.match(/ + : + + + /)) { alert ("works") } else alert(pattern.value + "Does not...
4
9704
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a numeric value according to an arbitrary regular expression.
11
5350
by: Dimitris Georgakopuolos | last post by:
Hello, I have a text file that I load up to a string. The text includes certain expression like {firstName} or {userName} that I want to match and then replace with a new expression. However, I want to use the text included within the brackets to do a lookup so that I can replace the expression with the new text. For example:
5
1640
by: Terry Olsen | last post by:
Is there a good way to find a pattern of bytes/chars in a stream? I've got a serial port connected to a tcp port. I need to be able to catch a unique character string in the stream so that I can perform certain functions. For example, I have a telnet client connected to an Apple II through the serial port. The user at the telnet terminal...
19
3153
by: konrad Krupa | last post by:
I'm not expert in Pattern Matching and it would take me a while to come up with the syntax for what I'm trying to do. I hope there are some experts that can help me. I'm trying to match /d/d/d/s/d/d in any text. There could be spaces in front or after the pattern (the nnn nn could be without spaces also) but it shouldn't pick it up in...
4
2103
by: mosesdinakaran | last post by:
Can any one explain how the rule is applied for the following Regular expression $Str = 'the red king'; $Pattern = '/((red|white) (king|queen))/'; preg_match($Pattern,$Str,$Val); Result:
0
7178
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7128
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7543
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5704
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5103
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4759
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3255
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3242
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
473
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.