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

Understanding Operating Systems (Zero-cost course material) Unit 5 Lab

Understanding Operating Systems (Zero-cost course material) Unit 5 Lab Assignment 5: Networking and Security (40 points) In this assignment, you will learn to check network configurations and services and to configure an IP address on a computer. For each of the two questions, do the following: 1. Create a document (use

Research – System Analysis and design Assignment 9.1 – Business Processes and Process Management Research a scholarly paper or

Research – System Analysis and design Assignment 9.1 – Business Processes and Process Management Research a scholarly paper or professional video on  “Business Processes, and Process Specifications”  and reflect on only one (1) of the following topics: · “Processes”: What type of business system’s Processes exist? · “Specifications”: How important

1. Prepare a professional cover letter Articulate effective interview strategies Explain the difference between a “good” interview and a “bad” interview

1. Prepare a professional cover letter Articulate effective interview strategies Explain the difference between a “good” interview and a “bad” interview Lecture notes There are 3 sections of a cover letter that are required when writing a professional cover letter to include with your resume: Introductory paragraph (to attract the

PROJECT DESCRIPTION The use of digital media has transformed how companies communicate with their customers. The use of the websites, YouTube, e-books, e-mail

PROJECT DESCRIPTION The use of digital media has transformed how companies communicate with their customers. The use of the websites, YouTube, e-books, e-mail and various forms of social media such as Facebook, Twitter, Pinterest, Snapchat, Instagram, and blogs has shaped current day communication strategies. Project 1 Consists of: 1. Project