test1.txt // Function with Arithmetic Expression function main returns integer; begin 7 + 2 * (5 + 4); end; test2.txt // Function with a

test1.txt

// Function with Arithmetic Expression

function main returns integer;
begin
7 + 2 * (5 + 4);
end;

test2.txt

// Function with a lexical error

function main returns integer;
begin
7 * 2 $ (2 + 4);
end;

test3.txt

// Punctuation symbols

,;() =>

// Identifier

name name123

// Literals

123 ‘a’

// Logical operator

&

// Relational operator

<

// Arithmetic operators

+ *

// Reserved words

begin case character end endswitch function is integer list of returns switch when

test4.txt

// Function with All Reserved Words

function main returns character;
number: real is when 2 < 3, 0 : 1;
values: list of integer is (4, 5, 6);
begin
if number < 6.3 then
fold left + (1, 2, 3) endfold;
elsif 6 < 7 then
fold right + values endfold;
else
switch a is
case 1 => number + 2;
case 2 => number * 3;
others => number;
endswitch;
endif;
end;

test5.txt

// Program Containing the New Operators

function main b: integer, c: integer returns integer;
a: integer is 3;
begin
if (a < 2) | (a > 0) & (~b <> 0) then
7 – 2 / (9 % 4);
else
if b >= 2 | b <= 6 & !(c = 1) then
7 + 2 * (2 + 4);
else
a ^ 2;
endif;
endif;
end;

test6.txt

// Program Containing the New Comment, Modified Identifier
// and Real Literal and Hex and Character Literals

— This is the new style comment

function main b: integer, c: integer returns integer;
a: real is .3;
d: real is 5.7;
a__1: real is .4e2;
ab_c_d: real is 4.3E+1;
ab1_cd2: real is 4.5e-1;
hex: integer is #2aF;
char1: character is ‘C’;
char2: character is ‘\n’;
begin
hex + 2;
end;

test7.txt

// Function with Two Lexical Errors

function main returns integer;
begin
7 $ 2 ? (2 + 4);
end;

test8.txt

— Punctuation symbols

,:;() =>

// Valid identifiers

name_1
name_1__a2_ab3

// Invalid identifiers

name___2
_name3
name4_

// Integer Literals

23 #3aD

// Real Literals

123.45 .123 1.2E2 .1e+2 1.2E-2

// Character Literals

‘A’ ‘\n’

// Logical operators

& | !

// Relational operators

= <> > >= < <=

// Arithmetic operators

+ – * / % ^ ~

// Reserved words

begin case character else elsif end endcase endfold endif endswitch
fold function if integer is left list of others real returns right
switch then when

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Project 2: Design the Cloud Deployment Architecture  Step 10: Write and Submit the Final Cloud Deployment Architecture Plan  In this step, you will

Project 2: Design the Cloud Deployment Architecture  Step 10: Write and Submit the Final Cloud Deployment Architecture Plan  In this step, you will create and submit your consolidated Cloud Deployment Architecture Plan for email, software development, and backups and archiving. The Cloud Deployment Architecture plan, which should be between eight

1 Analyzing Healthcare Issues Your Name Capella University NHS4000: Developing a Healthcare Perspective Instructor Name Month,

1 Analyzing Healthcare Issues Your Name Capella University NHS4000: Developing a Healthcare Perspective Instructor Name Month, Year 2 Health disparities among individuals with low socioeconomic status (SES) remain a persistent challenge in healthcare reflecting systemic inequalities that impact access, outcomes, and overall well- being. This paper will explain this issue