Results 1 to 10 of 28

Thread: Beginners programming challenge #27

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Location
    Canada, Montreal QC
    Beans
    1,809
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Beginners programming challenge #27

    Welcome to the 27th Beginners programming challenge.
    Because I have a bit of free time, I decided to post this programming challenge early.
    This means it will be a bit more complicated and will probably take more work to achieve.

    Task
    You will have to implement a small regular expression engine that imitates a small subset of the Perl style regular expressions. It will only have to do matching, no need for replace or other complicated features.
    You will then use it in a program that will take input and print the text that was first matched by the regular expression. Hopefully, this will introduce you to regular expressions and understand how such an engine works.
    These are the operators you will have to implement: * . $ ^ ? + and of course normal letters.

    Cookie points

    Cookie points will be awarded for the following extras:

    1. Implementing the | (or) operator.
    2. Implementing character classes (annotated with []).
    3. Take input from stdin if a file is not supplied so piping is possible on the command line.
    4. Printing every match and not only the first one.

    Disqualified Entries:

    Any overly obfuscated code will be immediately disqualified without account for programmers skill. Please remember that these challenges are for beginners and therefore the code should be easily readable and well commented.

    Any non-beginner entries will not be judged. Please use common sense when posting code examples. Please do not give beginners a copy paste solution before they have had a chance to try this for themselves.


    Assistance:

    If you require any help with this challenge please do not hesitate to come and chat to the development focus group. We have a channel on irc.freenode.net #ubuntu-beginners-dev
    Or you can pm me

    Have fun,
    Happy coding

    cgroza
    Last edited by cgroza; July 8th, 2012 at 11:38 PM.
    I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones.
    Freedom is measured in Stallmans.
    Projects: gEcrit

  2. #2
    Join Date
    May 2008
    Location
    UK
    Beans
    1,448
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Beginners programming challenge #27

    Great Challenge - I am not a beginner but I might have a go at this, and see how i get on. Any submission from me will be in Python though - and i promise not to use the re module.
    Tony - Happy to try to help.
    Unless otherwise stated - all code posted by me is untested. Remember to Mark the Thread as Solved.
    Ubuntu user number # 24044 Projects : TimeWarp - on the fly Backups

  3. #3
    Join Date
    Sep 2009
    Location
    Canada, Montreal QC
    Beans
    1,809
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: Beginners programming challenge #27

    Quote Originally Posted by Tony Flury View Post
    Great Challenge - I am not a beginner but I might have a go at this, and see how i get on. Any submission from me will be in Python though - and i promise not to use the re module.
    If you think you are not a beginner and you think it would be unfair for other users, you could post your solution after the winner is announced. And yes, the users are not allowed to use libraries that are directly related with regular expression engines, the goal is to implement it themselves .
    I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones.
    Freedom is measured in Stallmans.
    Projects: gEcrit

  4. #4
    Join Date
    May 2008
    Location
    UK
    Beans
    1,448
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Beginners programming challenge #27

    No intention of posting my solution until the winner is announced - although right now I am stuck - so unless i can solve that - i wont be able to post anything.
    Tony - Happy to try to help.
    Unless otherwise stated - all code posted by me is untested. Remember to Mark the Thread as Solved.
    Ubuntu user number # 24044 Projects : TimeWarp - on the fly Backups

  5. #5
    Join Date
    Aug 2005
    Location
    The Local Group
    Beans
    631

    Re: Beginners programming challenge #27

    In my opinion, the level of this problem is more intermediate than beginner. I'd love to be pleasantly surprised by a bunch of beginners rising to the challenge, though.

  6. #6
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,451

    Re: Beginners programming challenge #27

    Yeah, this really is more intermediate, although some undergrad CS education on grammars, formal languages and automata should provide one with references to literature where this is handled. Any ad hoc solutions are almost certainly wrong.
    LambdaGrok. | #ubuntu-programming on FreeNode

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •