Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Languages and Paradigms COMP 302, Winter 2018 Assignment 2 Due date: Wednesday, February 28, 2018 This assignment focuses on building and validating a parser

image text in transcribedimage text in transcribedimage text in transcribed

Programming Languages and Paradigms COMP 302, Winter 2018 Assignment 2 Due date: Wednesday, February 28, 2018 This assignment focuses on building and validating a parser for the WML language within Scala. Your code must run without error or modification using Scala 2.12 Note that you must follow the given naming, input, and output requirements precisely. All code should be well-commented, in a professional style, with appropriate variables names, indenting (uses spaces and avoid tabs), etc. The onus is on you to ensure your code is clear and readable. Marks will be very generousl;y deducted for bad style, lack of clarity, or failing to follow the required instructions. Your code should endeavour to follow a pure functional programming style. In particular, and unless specifically stated otherwise, all data types must be immutable, and data may not be modified once assigned or bound. Note that this means you may not use var declarations, while or do-loops, ArrayBuffers or other mutable structures, nor may you reassign Array element values after creation The goal of this assignment is to be able to successfully parse the WML language described in class, and presented as an explicit grammar in the accompanying grammar.txt file 1. (a) For each of the non-constant tokens in the WML grammar define a regular expression (Regex 8 object) that would match it precisely at the start of a string. Bind your regular expressions to val's, named as per the token name, with a capital starting letter and all other letters lowercase Note that "anything" in some of the token descriptions includes whitespace (and newlines too!) Answer this question by providing a file qla.scala that contains only the requested val defini- tions (as something you could cut-and-paste into the REPL), without any outer wrappers Programming Languages and Paradigms COMP 302, Winter 2018 Assignment 2 Due date: Wednesday, February 28, 2018 This assignment focuses on building and validating a parser for the WML language within Scala. Your code must run without error or modification using Scala 2.12 Note that you must follow the given naming, input, and output requirements precisely. All code should be well-commented, in a professional style, with appropriate variables names, indenting (uses spaces and avoid tabs), etc. The onus is on you to ensure your code is clear and readable. Marks will be very generousl;y deducted for bad style, lack of clarity, or failing to follow the required instructions. Your code should endeavour to follow a pure functional programming style. In particular, and unless specifically stated otherwise, all data types must be immutable, and data may not be modified once assigned or bound. Note that this means you may not use var declarations, while or do-loops, ArrayBuffers or other mutable structures, nor may you reassign Array element values after creation The goal of this assignment is to be able to successfully parse the WML language described in class, and presented as an explicit grammar in the accompanying grammar.txt file 1. (a) For each of the non-constant tokens in the WML grammar define a regular expression (Regex 8 object) that would match it precisely at the start of a string. Bind your regular expressions to val's, named as per the token name, with a capital starting letter and all other letters lowercase Note that "anything" in some of the token descriptions includes whitespace (and newlines too!) Answer this question by providing a file qla.scala that contains only the requested val defini- tions (as something you could cut-and-paste into the REPL), without any outer wrappers

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sql++ For Sql Users A Tutorial

Authors: Don Chamberlin

1st Edition

0692184503, 978-0692184509

More Books

Students also viewed these Databases questions