views:

171

answers:

4

I have a school assignment which consists of programming a scanner/lexical analyzer for a specified simple language. The scanner has to be programmed in C++.

This type of assignment has been used since the 90's and, although still a valid excersise, I consider it to be a little antiquated and a little boring.

I have gotten permission to come up with a new programming assignment. It has to be of equal difficulty and it can be in C++, Objective C or Java.

What direction should I go that has the same level of difficulty but is a little bit more modern and applicable to modern CS/life.

Thanks

+2  A: 

Why do you think that Lexers / Parsers are not relevant anymore? I find that I write something along those lines at least once a year.

Stephen C
+8  A: 

This type of assignment... is considered to be a little antiquated and a little boring.

I'm curious: who considers this antiquated? Your professor? Somebody notable in the parsing community? Or you?

Scanners and parsers are still relevant to professional software development and, more importantly, relevant to the science of computation. If you wish to understand computers, then you should understand scanners and parsers.

Still, if you are convinced that you should do some other assignment, why not write a tool to generate a scanner in C++? You could supply, as input, a set of regular expressions that define the tokens of the grammar, and it would produce a C++ program that would recognize the input tokens. Then, you will never need to write a scanner ever again!

Daniel Yankowsky
+1 for the suggestion. Though it would hardly be a challenge for someone as smart as the OP ;-)
Stephen C
It is not the challenge I have a problem with, writing a scanner is definitely challenging. The problem is that other students are finding it boring (I do to). This is a 4th year assignment, there are projects in the 2nd year which are much more fun to do and cover the same concepts. So coming into 4th year and doing this is boring for alot of students as Stephen C aptly noticed.Also, where are you reading that I think scanners and parsers are not relevant??The fact is that this assignment doesn't match the current projects and classes, it is a left over from the past.
bing
So if you do think they're relevant, you're saying "I want to skip relevant knowledge because I find it boring"? Perhaps you shouldn't study CS then.
jalf
@DanielGood idea, like a simple version of Flex.This may be a good project for a group of students over multiple semesters. I'm looking for something which can be done by a single person in one semester.I'm not sure though if you're being sarcastic, but thank you anyway.
bing
@jalfNo! I don't want to skip it. I want to put the relevant knowledge in a different assignment. Don't tell me that building a scanner is the only way in the world to learn.Is my question that weird and incomprehensibly written? English is not my first language, but I figured it's pretty plain.To reiterate, yes I find this exercise boring and many fellow students with me. Normally you just endure the boring stuff and savour the interesting stuff. Now I'm in the position at school to change that and I want to make use of it.
bing
I will admit, I was being a bit sarcastic (and also a bit serious). Since English isn't your native language, I think I should admit that much. It sounds like the assignment is boring because it is too easy for you and your classmates. So, it seems natural to try something harder.
Daniel Yankowsky
Another idea, and something that I've wanted for a while, is a resumable regular expression engine. My biggest problem with most RE libraries is that they match a RE against a string. If the string is being read from a stream, like a socket or a file, we need to read the whole stream before attempting a match. That's wasteful. After I create the regular expression, I would like to push characters into it one at a time. When the RE notices a success, it fires an event into a listener. This assignment would teach many of the same principles, and should be completable in a short period of time.
Daniel Yankowsky
+1  A: 

As a software engineer, I would say whatever code you write during the CS courses would be the best ones that you may probably write in your life. Once you come into the industry, you will probably write only modules and not the entire thing.

Believe me. Once you come into the industry and has spend some time here, you will just want to write those compilers, assemblers, lexical analyzers. So please don't miss the chance.

I believe the challenges in writing this "boring" stuffs are just worth it and you will find them truly interesting once you start designing the stuff.

Techiegirl
+1  A: 

Writing a scanner/lexical analyzer was one of my favorite assignments. I would argue that it was also one of the most relevant. It is a real world problem.

My guess is that it does not feel modern because of the simple programming language you are scanning. I personally would change out the simple programming language for something like Markdown or Textile. Both of these are used in modern programming, and will teach you similar concepts.

Colin Gislason