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 7181089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:29:03+00:00 2026-05-28T17:29:03+00:00

Official problem: Write Java method to perform recursive descent parse of the following production:

  • 0

Official problem:

Write Java method to perform recursive descent parse of the following production:

<repeat_statement> -> REPEAT <statement> UNTIL <expression> ;

This is what I’ve come up with:

void repeatStatement() {
    if(token == REPEAT) {
        token = getNextToken();
        if(parseStatement()) {
            if(token == UNTIL) {
                token = getNextToken();
                if(parseExpression()) {
                    if(token == ;) {
                        return true
                    }
                }
            }
        } return false
    }

I’m pretty confident that I have the general idea here, but I was hoping that someone could help me polish this/ confirm that I’m on the right track.

  • 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-28T17:29:04+00:00Added an answer on May 28, 2026 at 5:29 pm

    It looks (vaguely) like you’re trying to evaluate the repeat statement. That’s not what recursive descent parsing does. I’d expect something like this (in pseudocode):

    RepeatStatement repeat_statement() throws ParseException {
        if (!consume("REPEAT")) {
            throw new ParseException("no REPEAT token");
        }
        Statement statement = statement();
        if (!consume("UNTIL")) {
            throw new ParseException("no UNTILtoken");
        }
        Expression expression = expression();
        if (!consume(";")) {
            throw new ParseException("no closing semicolon");
        }
        return new RepeatStatement(statement, expression);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know the official method for submitting feedback on C# 4.0 so that
I am using the HTML5 Boilerplate and never had a problem with it until
I have a problem with Hibernate (3.6.0.-Final) in my Java EE application using MySQL
I have the following problem. When I developed my application locally I was deploying
After following the official tutorial here: tutorial I'm still having issues adding rows/creating a
Official guide says: Tomcat deployment is trivial and requires copying the WAR file into
The official oauth guide makes this recommendation: It is important not to try and
Is there an official convention for naming private fields in VB.NET? For example, if
So the official XML-RPC standard doesn't support 64-bit values. But in these modern times,
I have seen the official demos on lwjgl.org but I would like to see

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.