Write the EBNF for mini Java language based of the following information: Data Types Integer Int Long Double Boolean Char References Complex Data Structures Arrays int v[30]; Classes member...

60.1K

Verified Solution

Question

Programming

Write the EBNF for mini Java language based ofthe following information:

Data Types

  • Integer
    • Int
    • Long
  • Double
  • Boolean
  • Char
  • References

Complex Data Structures

  • Arrays
    • int v[30];
  • Classes
    • member variables
      • class Name {
      • int a;
      • char b;
      • char name[25];
      • }

Methods

  • Return data type
    • Primitive data type
    • Void
  • Method Name
  • Parameter list
    • Could be empty
  • Statement Block
    • {
    • Variable declarations
    • Executable Statements
    • }

Program

  • Variable Declarations
  • Class Definitions
  • Methods
  • Only one method named \"main\" but must have one method namedmain

Statements

  • Expression Statements
    • Assignment operation allowed in expressions
    • Add, Sub, Mult, Divd, 6 comparisons, Logical operations (and,or, not), Assignment
  • If statements
    • else is allowed but optional
  • While statements
  • Print
    • eol value to go to new line
    • allow multiple print items
  • Return statement - returns the value of an expression

Statement Blocks

  • Enclosed in braces
  • Separate statements using semicolons

Answer & Explanation Solved by verified expert
4.2 Ratings (817 Votes)
ANSWER Type PrimitiveType ReferenceType PrimitiveType int boolean ReferenceType ClassType ArrayType ClassType Name ArrayType PrimitiveType ClassType ArrayType Names Name SimpleName QualifiedName SimpleName Identifier QualifiedName Name Identifier Packages CompilationUnit TypeDeclaration TypeDeclaration ClassDeclaration Modifiers Modifiers Modifier Modifier public static native Classes Class Declaration ClassDeclaration class Identifier Superopt ClassBody Super extends ClassType ClassBody ClassMemberDeclaration ClassMemberDeclaration FieldDeclaration MethodDeclaration Field Declarations FieldDeclaration Modifiers Type    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students