CS508 – Modern Programming Languages semester Fall 2020 Solution Assignment No. 02
Please read the following instructions carefully before solving &
submitting assignment:
Uploading Instructions:
Ø You can use simple Notepad or any other text editor (like Sublime
Text, Atom, VS Code etc.) for coding.
Ø For compilation purpose, any online compiler can be consulted, like https://tio.run/#snobol4
Ø After completion, copy all the code; it must be a simple text, which
should not contain any format or style.
Ø Paste it in text view at Student Inline Solution
interface and click on save button.
Ø You can update your solution any time but before the deadline.
Ø Unlike previous semesters, you do no need to upload any file at VU-LMS.
New VU-LMS design allows you to write the solution of assignment directly at VU-LMS.
Ø After upload, make sure the submitted code is properly visible and
in readable form.
Ø No assignment will be accepted through email.
Rules for Marking:
It
should be clear that your assignment will not get any credit if:
Ø The assignment is submitted after due date.
Ø Ø The assignment is not submitted in proper format (i.e. simple text, without any format/style).
Ø The assignment is fully or partially copied from other student or ditto copy from handouts or
Internet; strict disciplinary action will be taken in this case.
Ø The submitted code is not readable; during evaluation, submitted code will be checked using
simple text editor. If code is not readable due to wrong format or style then ZERO marks
will be awarded and no excuse will be accepted in this regard.
Note: Do not put any query on MDB regarding this assignment, if you have any query
then email at cs508@vu.edu.pk
Lectures Covered: This assignment covers Lecture # 9 - 15
Problem Statement:
Punctuation is the system of signs or symbols, given to a reader to show how a sentence is constructed
and how it
should be read and makes the meaning clear.
You are required to write a program in SNOBOL4 which will count the total number of punctuation
characters in a string.
· At start, take a string as input from user.
· Print that string on top of the console screen.
· Design a pattern which should contain punctuation marks as given below.
· Create a loop using 'go to field', which will match characters of string with pattern.
· If any character in string is matched and not repeated then store it in a variable by
using concatenation, increment the counter by 1, and move to the next character.
· At end, simply print the counter and stored characters on console with appropriate message.
For example, if input string is
Good Morning! Mr. ABC, have your
breakfast?
Then your program must
print on console,
Found 4 punctuation marks (i.e. ! . ,
?) in the given string.
However, in case, there is no punctuation mark in the input string then following message
should be
displayed.
Found no punctuation mark in the
given string.
Note:
It is required to make sure that the program should count only one for same punctuation marks if
repeated twice or more. For example, the program must count 4 punctuation marks for string
"Yesterday, rain-fog; today, frost-mist. But how fascinating
each."
For compilation purpose, you can use
any online compiler, like https://tio.run/#snobol4