It's UWAweek 51

help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying the 2 articles in this topic
Showing 2 of 835 articles.
Currently 19 other people reading this forum.


 UWA week 37 (2nd semester, week 7) ↓
SVG not supported

Login to reply

👍?
helpful
3:30pm Fri 13th Sep, Amitava D.

ANONYMOUS wrote:
> Hi, would the following code as a .ml file be syntactically valid? > > Additionally, can comments be indented with a '/t' outside of a function or will this cause an error? Chris has said randomly indented lines outside of a function is not permitted, but I am not sure if this applies to comments as well. > > This file also assumes that whitespace anywhere except at the start of the line is valid (therefore any line starting with a whitespace (even if it is a commented out line with just #), including any lines with whitespace before or after a '\t' character within a function, causes an error). > Could I please get a clear cut yes or no whether or not this is true instead of a link to another help forum post, I have read all of the posts regarding whitespaces and still am not certain if this is correct. The post that is always linked says 'Whitespace can only appear at the beginning of a line if it is a tab under a function definition' is true, but whitespace and tab are not the same thing so it is confusing. > > > ``` > # this file should print the following (only the numbers): > # 9 > # 16 > # 0 > # 2 > # 2.500000 > # 3 > # 1 > # > # > # > # additional whitespace except at the start of a line is valid (? still waiting on clarification ?) > # 9 is printed > one <- 1 > # > function increment value > return value + one > # > print increment( 3 ) + increment ( 4 ) > # > # > # > # from [help2002] > # functions can call another function as a parameter > # 16 is printed > function printsum a b > print a + b > print printsum(increment( 5 ) , 10) > # > # > # > # variables do not need to be defined before being used in an expression, and are automatically initialised to the (real) value 0.0 > print d > # > # > # > $ from [help2002] > # functions do not need to end with a return or print statement, if there is no tab the function has ended > # variable reassignment is allowed > # 2 is printed > function none > one -> 2 > none( ) > print one > # > # > # > # comments can start in the middle of a line > # 2.500000 is printed > print 2.5 # comment > # > # > # > # from [help2002] > # 3 is printed then 1 is printed, since noreturn(1, 2) would return 0 > function noreturn x y > print x + y > print 1 + noreturn(1, 2) > ```
You should make simplifying assumptions, and clearly write those assumptions in your report. I am not sure whether a report was required in the original project description, but you can submit a report that lists all the assumptions you have made.


SVG not supported

Login to reply

👍?
helpful
10:19pm Fri 13th Sep, ANONYMOUS

In the submission requirements it says the following: Submit only a single C11 source-code file named runml.c Do not submit any header-files, documentation, instructions Is this going to be changed so a report can also be submitted? If so, would it be appropriate to include code examples of errors along with the syntax assumptions made?

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy