It's UWAweek 47

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 828 articles.
Currently 63 other people reading this forum.


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

Login to reply

👍?
helpful
5:08pm Sat 14th Sep, Yuxuan Z.

1. "All syntax errors detected in invalid ml programs must be reported via stderr on a line commencing with the '!' character. Your runml program must be able to detect all invalid ml programs - EXCEPT that your program will not be tested with any invalid expressions, so you do not need to validate the syntax of expressions." I am confused about invalid expressions here. Do we need to consider scenarios like incomplete variable assignment (ex. a <- ), unpexted characters in the end of the line (ex. a <-2 ;), unmatched number of parameters in function call ( function add(a,b) but call with add(a)), and incomplete parenthesis ( print add(a,b )? However, in the previous thread you said that indentation is a factor we should consider, so what is the specific scenarios we should work on? I am so confused about the boundary line between invalid expression and invalid ml program. Can you provide a list of what counts as invalid expressions and what don't? 2.There is a requirement in ml language: "the variables arg0, arg1, and so on, provide access to the program's command-line arguments which provide real-valued numbers" I am confused that if accepting user input one of the features of ml languages? Also, does our transpiler accept multiple ml files in the same time? ( ex. ./runml program1.ml program2.ml program-n.ml)


SVG not supported

Login to reply

👍?
helpful
10:40pm Sat 14th Sep, Joshua N.

"Yuxuan Zhang" <24*1*6*3@s*u*e*t*u*a*e*u*a*> wrote: Hi Yuxuan
> 1. "All syntax errors detected in invalid ml programs must be reported via stderr on a line commencing with the '!' character. Your runml program must be able to detect all invalid ml programs - EXCEPT that your program will not be tested with any invalid expressions, so you do not need to validate the syntax of expressions." > > I am confused about invalid expressions here. Do we need to consider scenarios like incomplete variable assignment (ex. a <- ), unpexted characters in the end of the line (ex. a <-2 ;), unmatched number of parameters in function call ( function add(a,b) but call with add(a)), and incomplete parenthesis ( print add(a,b )? > > However, in the previous thread you said that indentation is a factor we should consider, so what is the specific scenarios we should work on? I am so confused about the boundary line between invalid expression and invalid ml program. Can you provide a list of what counts as invalid expressions and what don't?
You are allowed to make assumptions and submit them with your code submission. I believe the original intension was that all expressions will be valid, so you don't need to check them. Statements in a function should be 1 tab and everything else should not be indented (here we are checking the statement is valid). Variable assignment would also be a possible syntax error since it is a statement, not an expression. I think Amitava said you don't need to check unmatched parameters in a function call as he said here: [help2002] If you are confused what is considered an expression, I would recommend double checking the ml syntax guide. [CITS2002] Find the word "expression", and all the syntax underneath it you don't need to check (i.e. expressions and things that make up expressions.). However, you do need to have a way of knowing if a variable was defined before, so you can initialize it to 0 if it is new.   I would also recommend rereading the project description and the ml syntax guide to get an idea of the different syntax errors. Since I'll just be restating what was written there. Especially the sections titled "Our ml Language" and "project requirements".
> 2.There is a requirement in ml language: "the variables arg0, arg1, and so on, provide access to the program's command-line arguments which provide real-valued numbers" > > I am confused that if accepting user input one of the features of ml languages? Also, does our transpiler accept multiple ml files in the same time? ( ex. ./runml program1.ml program2.ml program-n.ml)
Your runml program **only** accepts one ml file at a time and any **optional** arguments. Similar discussion here [help2002] e.g.
./runml sample01.ml
./runml samplewitharguments.ml 1 2 3
The arguments in ml appear as variables in the ml file, arg0, arg1, and so on. So, you initialize these variables to the value passed into the program. e.g. arg0 = 1, arg1 = 2, arg3 = 3. I hope that helps.

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