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

  • Home
  • SEARCH
  • 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 79643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:10:40+00:00 2026-05-10T21:10:40+00:00

I’ve been trying to create a parser using simpleparse. I’ve defined the grammar like

  • 0

I’ve been trying to create a parser using simpleparse. I’ve defined the grammar like this:

<w> := [ \n]* statement_list := statement,(w,statement)? statement := 'MOVE',w,word,w,'TO',w,(word,w)+ word := [A-Za-z],[A-Za-z0-9]*,([-]+,[A-Za-z0-9]+)* 

Now if I try to parse a string

MOVE ABC-DEF TO ABC MOVE DDD TO XXX 

The second statement gets interpreted as parameters of the first one… This sucks and is obviously not what I want. I have been able to get this working using pyparsing like this:

word = Word(alphas,alphanums+'-') statement = 'MOVE'+word+'TO'+word statement_list = OneOrMore(statement.setResultsName('statement',True)) 

Is there any way to get this working in simpleparse as well?

EDIT: clarification below

I am not trying to achieve a line-based grammar. What I would like to see being parsed is:

Simple case

MOVE AA TO BB 

More comlex case

MOVE AA TO BB             CC DD             EE FF 

Several of the above statments

MOVE AA TO BB             CC MOVE CC TO EE MOVE EE TO FF             GG             HH IIJJK 
  • 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. 2026-05-10T21:10:41+00:00Added an answer on May 10, 2026 at 9:10 pm

    The grammar is currently ambiguous. On paper you cannot parse if ‘MOVE A TO B MOVE C TO D’ is two statements, or one statement with particular badly named destinations.

    You have two answers. You may like neither.

    1. You explicitly make your WORD not match any reserved word. That is, you specifically disallow matching MOVE or TO. This is equivalent to saying ‘MOVE is not a valid parameter name’. This makes ‘MOVE TL TO TM TN TO’ an error.

    2. You modify your grammar so that you can tell where the statement ends. You could add commas ‘MOVE AA TO BB, CC MOVE TM TO TN, TO, TP’. You could add semi-colons or blank lines at the end of statements. You could require that MOVE be the least indented, like Python.

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

Related Questions

Loading...

Sidebar

Ask A Question

Stats

  • Questions 54k
  • Answers 54k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You can discover the IP addresses the Google and others… May 11, 2026 at 7:25 am
  • added an answer You need to use strptime() to convert the string to… May 11, 2026 at 7:25 am
  • added an answer I would use VARCHAR for variable length data, but not… May 11, 2026 at 7:25 am

Top Members

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

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.