正则表达检查器

英国it课程补习范文精选:“正则表达检查器”,这篇论文主要介绍了如何使用递归的方法来实现检查器正则表达。文章指出,实现这个结果的关键在于编写一个程序,再使用递归函数来检查一系列字符串,并查看它们是否是格式良好的表达式。

 

Assignment Synopsis

 

Write a program that employs a recursive function to check a series of strings to see if they are well-formed expressions.

 

Input

 

The program must read an arbitrary series of zero or more strings from standard input. Input strings are to be separated by white space. For example, you can enter them one per line. There is to be no other input to the program. The sample input illustrates the kind of input I will use to test your program.

 

Output

 

The program must write all output to standard output. First the program must write a heading/greeting message. Next, for each input string, the program must go to a new line of the output, echo (write) the input string to standard output, go to a new line again, and print a message telling whether the string is a well-formed expression. Finally, after processing all the input, the program prints an exit message and stops. There is no other output. If you are entering input at the keyboard, the program should stop reading input when you enter the end-of-file characater (cntrl-d).

 

This script shows the output produced in response to the sample input file.

 

Discussion of Processing

 

The following rule defines a well-formed expression:

 

<expr> = S|I(C)T(<expr>)

 

Your solution to this problem must be “recursive” – it must use a recursive function to test the strings. Design the function to input a string and output ‘true’ or ‘false’ – telling whether or not the string is an expression.

 

In class, we can discuss solutions to some problems that are similar to this one. That should give you some useful ideas for writing your program. In your solution code, you may want to use the substr method of the string object.

 

Testing

 

We’ll have a discussion of testing requirements in class. Never assume that sample inputs I give you with an assignment represent everything you need to test to make sure your program is correct.

 

What To Turn In

 

I am not requiring you to turn in a preliminary version. One can solve this problem with a very small program. My solution has just two functions, including main. Do not start coding until you think of a simple algorithm. If you are considering a solution that is complicated, then you are not using the right approach. If you don’t think of a simple solution after the first day of working on it, ask me for help (please!). You can ask me privately if you want, but I do like to get some questions in class, so I can help more than one person at a time.

 

You will send me one e-mail message. Please follow these rules:

1.Send me attachments of your program as a .Java file.

2.Always use the exact subject line I specify for each message. (I often get hundreds of e-mail messages in a week. The subject line allows me to find, filter and sort messages.) You will lose a significant number of points on the assignment if you use the wrong subject line.

3.Make sure you have the correct subject line and filename.

4.Always send yourself a copy of each e-mail message you send to me, and check to see if you receive the message intact. You are responsible for sending e-mail correctly.

 

Here is the list of things you have to turn in.

 

51Due作为专业的留学教育辅导机构,专业辅导语言学论文代写硕士paper代写英国matlab作业代写,自2004年至今,坚持以学生为中心,全天候服务,为海外留学生完成了数万篇assignment代写、essay代写、report代写、dissertation代写等论文,以优质的英国代写服务赢得留学生的信赖,如有英国代写code需求或者英国it课程补习需求,欢迎咨询51Due哦。

 

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s