Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6978191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:43:24+00:00 2026-05-27T17:43:24+00:00

As part of a small project I’m working on, I need to be able

  • 0

As part of a small project I’m working on, I need to be able to parse a string into a custom object, which represents an action, date and a few other properties. The tricky part is that the input string can come in a variety of flavors that all need to be properly parsed.

Input strings may be in the following formats:

Go to work tomorrow at 9am

  • Wash my car on Monday, at 3 pm
  • Call the doctor next Tuesday at 10am
  • Fill out the rebate form in 3 days at 2:30pm
  • Wake me up every day at 7:00am

And the output object would look something like this:

{
   "Action":"Wash my car",
   "DateTime":"2011-12-26 3:00PM", // Format is irrelevant at this point
   "Recurring":False,
   "RecurranceType":""
}

At first I thought of constructing some sort of tree to represent different states (On, In, Every, etc.) with different outcomes and further states (candidate for a state machine, right?). However, the more I thought about this, the more it started looking like a grammar parsing problem. Due to a (limited) number of ways the sentence could be formed, it looks like some sort of grammar parsing algorithm would need to be implemented.

In addition, I’m doing this on the front end, so JavaScript is the language of choice here. Back end will be written in Python and could be used by calling AJAX methods, if necessary, but I’d prefer to keep it all in JavaScript. (To be honest, I don’t think the language is a big issue here).

So, am I in way over my head? I have a strong JavaScript background, but nothing beyond school courses when it comes to language design, parsing, etc. Is there a better way to solve this problem? Any suggestions are greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:43:24+00:00Added an answer on May 27, 2026 at 5:43 pm

    I don’t know a lot about grammar parsing, but something here might help.

    My first thought is that your sentence syntax seems to be pretty consistent

    1st 3-4 words are generally VERB text NOUN, followed by some form of time. If the total options are limited to what form the sentence can take, you can hard-code some parsing rules.

    I also ran across a couple of js grammar parsers that might get you somewhere:

    http://jscc.jmksf.com/
    http://pegjs.majda.cz/
    http://www.corion.net/perl-dev/Javascript-Grammar.html

    This is an interesting problem you have. Please update this with your solutions later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a small design project, part of which involved writing out text
I have a small project where I need just part of boost library, boost::regex
I am working on a project and there is a small part of it
I'm working on a small project that involves grabbing a list of contacts which
Have been working on a small project, and have gotten stuck at a part
I'm working on a small project in C where I have to parse a
A part of a small project I am working on involves 'calibrating' the coordinates
I'm part of a small team trying to start coding on a project. I've
I am part of a small team ( 4 - 5 ) people working
I work on a small Agile development team which is part of a large,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.