Professional Documents
Culture Documents
Problem Statement:: Assignment No. 02 Semester: Fall 2021 Total Marks: 20 BC180407494
Problem Statement:: Assignment No. 02 Semester: Fall 2021 Total Marks: 20 BC180407494
02 Total Marks: 20
Semester: Fall 2021 BC180407494
CS508 – Modern Programming Languages Due Date: Dec 24, 2021
Problem Statement:
You are required to write a program in SNOBOL4 which will take input from user, store in an array and then
print elements of the array in reverse order; the last element should be displayed first, followed by second
last element and so on.
1
Assignment No. 02 Total Marks: 20
Semester: Fall 2021 BC180407494
CS508 – Modern Programming Languages Due Date: Dec 24, 2021
However, in case, if input length is smaller than 1 or greater than 50 then following message should
be displayed.
Invalid: input should contain 1 to 50 characters.
Note:
It is required to make sure that the program should consider both small and capital alphabets ( i.e., a
to z & A to Z) and numbers (i.e., 0 to 9) as valid characters. Spaces and punctuation marks (! . , ; : ? etc.) must
be ignored. For example, the output of program for following string should be;
Input:
"Help!" she cried. "I can't swim!"
Output:
Valid Characters: HelpshecriedIcantswim
Original Order: H, e, l, p, s, h, e, c, r, i, e, d, I, c, a, n, t, s, w, i, m,
Reverse Order: m, i, w, s, t, n, a, c, I, d, e, i, r, c, e, h, s, p, l, e, H,
Compiler:
For compilation purpose, you can consult any online compiler, like
https://tio.run/#snobol4
Valid Characters:
Type Characters
Numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Small Alphabets a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
Capital Alphabets A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
SNOBOL4 Built-in Functions:
2
Assignment No. 02 Total Marks: 20
Semester: Fall 2021 BC180407494
CS508 – Modern Programming Languages Due Date: Dec 24, 2021
Function Description
SIZE(S) Return the number of characters in string S.
GT(X, Y) Integer X is greater than integer Y.
GE(X, Y) Integer X is greater than or equal to integer Y.
LT(X, Y) Integer X is less than integer Y.
LE(X, Y) Integer X is less than or equal to integer Y.
Sample Output:
Solution Code:
*bc180407494
STRING = INPUT
MSG = STRING
COUNT = SIZE(MSG)
3
Assignment No. 02 Total Marks: 20
Semester: Fall 2021 BC180407494
CS508 – Modern Programming Languages Due Date: Dec 24, 2021
VALID_ARRAY = ''
ORIGNAL_ORDER = ''
REVERSE_ORDER = ''
PATTERN = ('0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' |
'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | 'a' | 'b' | 'c' | 'd' |
'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z') $ A
HYPHEN = ('-') $ H
4
Assignment No. 02 Total Marks: 20
Semester: Fall 2021 BC180407494
CS508 – Modern Programming Languages Due Date: Dec 24, 2021
END