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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:48:44+00:00 2026-06-05T20:48:44+00:00

I am implementing parser for language similar to java but simpler. I have written

  • 0

I am implementing parser for language similar to java but simpler. I have written a lexer, and am now writing parser. I have written the grammar, I need to implement counting of elements but I have no idea were to put it. I think that it should be in action code after productions but I don’t know were to initialize it.

For example

MethodDecl ::= ReturnType:type IDENTIFIER:id LPAREN FormParsOp:pars RPAREN VarDeclListOp LBRACE StatementListOp RBRACE
       {: System.out.println("Method: " + type + " " + id + "(" + pars + ")");   methodNumber++;:} 
    | STATIC ReturnType:type IDENTIFIER:id LPAREN FormParsOp:pars RPAREN VarDeclListOp LBRACE StatementListOp RBRACE
       {: System.out.println("Static method: " + type + " " + id + "(" + pars + ")");  staticMethodNumber++;:} ;

Where should I define and initialize the variables methodNumber and staticMethodNumber?

  • 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-06-05T20:48:45+00:00Added an answer on June 5, 2026 at 8:48 pm

    Solved…
    I put them in action code and initialized there

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

Sidebar

Related Questions

In a web browser written in java different types of parser have been used
I'm trying to implement a simple Java like language parser in sablecc, although I'm
Implementing a simple Login screen using JSF and Spring and Hibernate. I have written
I'm writing a simple parser/interpreter for a language . The instructions keep mentioning 'deferred
I'm implementing a java SAX parser in my Android app. I've got everything working,
My knowledge about implementing a parser is a bit rusty. I have no idea
I'm implementing a regular expression parser by using algorithms in the dragon book. Now
I need to parse document using SAX parser in java. I was able to
Much has been written over the years on implementing parsers, but the C preprocessor
I need to use a C++ XML parser/writer for implementing virtual registry on the

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.