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

Operational Excellence Week 2 Assignment information

Operational Excellence Week 2 Assignment information Systems for Business and Beyond Questions · Chapter 2 – study questions 1-10, Exercise 2      Information Technology and Organizational Learning Questions · Chapter 2 – Note why the IT organizational structure is an important concept to understand.  Also, note the role of

Pg. 01 Project I Project Deadline: Sunday 12/5/2024 @ 23:59 [Total

Pg. 01 Project I Project Deadline: Sunday 12/5/2024 @ 23:59 [Total Mark is 14] Introduction to Database IT244 College of Computing and Informatics Project Instructions · You can work on this project as a group (minimum 2 and maximum 3 students). Each group member must submit the project individually with