BuyQualityEssays.com – Programming in Java with IntelliJ (2022 LATEST ANSWERS)/Computer Science

Programming in Java with IntelliJ
AssessmentYour work will primarily be assessed by automated tests for correctness. Grammar files not in the correct format (see below) are untestable and therefore will obtain zero marks. The same applies to uncompilable Java or SSM assembly code.Grammar Files (.sbnf)The tasks require you to write a context-free grammar for two variants of a simple programminglanguage. You must write these CFG’s in the Simple BNF format, as described at the end of this document. Your CFG’s are required to be LL(1). To verify that your grammar is LL(1), and that it is in the correct format, you may use the LL1Check tool provided. For example:java -jar LL1Check.jar data/lpse/lpse.sbnf(Java version 17 or above is required). If choice-conflicts are detected you may need to calculate some FIRST, FOLLOW and selection sets to determine the cause (you are not required to submit these calculations for assessment). Simple grammar transformations should suffice to resolve any such problems.Token DefinitionsYou must provide token definitions corresponding to the terminal symbols in your .sbnf files. In each case, you must implement your token definitions as the DEFS constant in the relevant Java class. The format is the same as the one used in TeenyWeenyTokens.java, in the Tutorial 3 solutions.
Task 1 [25%]Define an LL(1) grammar for the language LPse, described below. You will find many examples of LPse programs in the test folders provided. Write your grammar in the file data/lpse/lpse.sbnf and implement the token definitions for your grammar in lang.lpse.LPseTokens.java.LPse SyntaxAn LPse program starts with the keyword begin and ends with the keyword end. Between these keywords the body of a program consists of a (possibly empty) sequence of statements. A statement is either an assignment-statement, an if-statement, a while-statement, a printint- statement or a printchar-statement. Apart from if-statements and while-statements, statements must be terminated by a semi-colon. You can determine details of the syntax of each kind of statement from the examples provided in the test folders.Statements contain expressions built up from variable names, integer literals and the following operators: +, -, *, /,