ANONYMOUS wrote
Email Amitava "ami a a d t a u a e u a " d m i m t v S P
But most likely because it hasn't been fully out. Most likely you'll get it tmr like he mentioned in his email.
hello there just wondering if this is happening to anyone else but the project marks seem to be incorrect for our partners? i have the actual mark while my partner has 0 40 is there any way to check this? I was under the impression that we only neede...
Are there any updates on the marks for the first project? I know someone had said it would hopefully be before exams, but just checking if there has been any progress since then given it s the biggest non-exam assessment in the unit.
Thanks
ANONYMOUS wrote
There are no stupid questions. Only stupid answers.
I think either will be accepted since it wasn't specified if ml print statement will print a newline at the end or not. I think logically it would make more sense if ml did print a n...
https ipoint.uwa.edu.au app answers detail a id 2712
So it is OK to make my code public after this week? Assignments will not be accepted more than 7 days after the due date.
Hello,
This is probably a stupid question but since the results are compared using automated marking I want to clarify something.
The only 'true' output produced by your translated and compiled program (when running) is the result of executing ml's pr...
ANONYMOUS wrote
Do not make your code public until all the late submissions are in. Some people will have extensions and so they will still be doing their project.
My project code is hosted on the github, and my teammate and I worked on it as the 'private project', so it is not visible to the public. Since most students have submitted their work, is it acceptable to make my code public now? Thanks a lot.
ANONYMOUS wrote
I don't think Amitava can modify the website. Only Chris can because it is his website. I'm guessing Amitava will place updated on LMS as needed.
ANONYMOUS wrote
Doing your own research is fine so long as you use the approved c11 libraries (e.g. methods from string.h). I think a good rule of thumb is to only use the c libraries covered in labs and lectures.
Hi, I was wondering if we just have to only know content from Weeks 1-6 or can we go online and look at other methods that can be used in our project?
Thanks
I can't be 100 sure. If I had to guess it would have something to do with the compiler you are using. E.g. mac vs linux. gcc is more particular wants things done a certain why. I think clang is more lenient. Or in other words I think you are using d...
I have made a function which combines it, and it works but when I add it to the actual code, it is giving an error with one of the files. Another question is, I won't use the old way to compile but I don't understand why I wasnt working when I made t...
I don't think you completely understand how argument passing works in ml. Have you read these posts?
https secure.csse.uwa.edu.au run help2002?p np opt U441 hl arg0
https secure.csse.uwa.edu.au run help2002?p np opt U344 hl arg0
Firstly, remember that you need to submit 1 c source file. So, you need to merge these files together.
The error you are getting usually mean you are trying to compile an object file. In other words a file with the ".o" extension. Object files are us...
You would have to ask Chris since he wrote the project, usually it is fine. However, you definitely can't share the solution to the project until all late submission are in.
So the answer to this seems obvious but anyhow
It would be reasonable to assume we won't be tested on identifier names which are reserved keywords in C, right?
E.g. we would never get an identifier called "int" or "return" or "struct"... Putting reser...
Hi,
Are we supposed to compile and run generated c file from .ml file with -Wall -Werror flags?
For example,
cc -std c11 -Wall -Werror -o sample sample.c
Or is it acceptable to compile without the flags, like this?
cc -std c11 -o sample sample.c
...
I asked other student, we guess they should be a reference of parameter for generated C translation files, you can define like this char arg0 argv 1 in your c file, and the generated c file can use arg0 directly
i know the what is the mean arg0, arg1... but i couldn't get it "provide access to the program's command-line arguments which provide real-valued numbers' means." here.
I don't really understand what 'the variables arg0, arg1, and so on, provide access to the program's command-line arguments which provide real-valued numbers' means.
I would appreciate it if someone could explain what this means. Thank you
Is this list exhaustive? Requirement 3 specifies OS and POSIX functions as well - which functions are allowed? I am using unistd.h for execv and sys wait.h for wait as these were covered in lecture 9. Should I use system in stdlib.h inste...
ANONYMOUS wrote
This is not what Chris means. He means to not submit header files (e.g. you can't submit a header file you wrote). You still have to import header files or compilation will fail.
Your code won't compile if you do this.
This is what ...
ANONYMOUS wrote
You can make assumptions about any of the project requirements that are unclear. In the doc you are stating what you believe you are meant to do or what you believe the requirements are telling you to do. E.g. one assumption could be ...
ANONYMOUS wrote
No, I don't think so, since they represent the command line arguments. However, since it hasn't been clarified you can put whatever you assume in the doc.
ANONYMOUS wrote
Possibly, but it is a bit ambiguous you could probably have an assumption in your assumption doc about it.
This definitely has to be true.
I believe the point 9 is stating that in the ml file the function definition has to come before t...
No,regex.h is not permitted. regex.h may be a part of the system-provided POSIX library but you are only allowed to use the C11 standard library functions.
Refer this link to know the headers that you'll be allowed to use
https en.cppreference.com w...
G'day all,
Just a query regarding submission of our final runml.c code into cssubmit.
There is a liner under the Project 1 page, "Submission requirements", point number 2
'Submit only a single C11 source-code file named runml.c
Do not submit any header...
Hi all, we're so confused about the requirement in the lecturer email 16 09 24
"Please make any assumptions you may deem appropriate and base your implementation on those assumptions. Please submit the assumptions in a text or pdf document along wit...
9. a function must have been defined before it is called in an expression
Is this saying that if we call a function like printsum(x,y) that the printsum function is defined before it is called
Or is the dotpoint saying that if you call printsum there ...
Just for clarification, can we compile the translated C file with the command 'cc -std c11 -o output output.c' or it needs to be 'cc -std c11 -Wall -o output output.c'
Hello,
Just to confirm. Do we not have to validate any expressions which are assigned to a variable.
E.g. x - y 2.
Do we need to validate 'y 2', or do we only validate identifiers used in an expression?
Thanks
ANONYMOUS wrote
I believe Chris intended students to actually parse the strings themselves. If you want confirmation, you will have to ask Amitava. Honestly, I don't think regex.h will make your life easier.
Just making sure, is regex.h permitted? We have used some regex for string parsing. As far as I know, it is considered a system-provided (POSIX) library.
CITS2002 Project 1 2024
Student1 STUDENT-NUMBER1 NAME-1
Student2 STUDENT-NUMBER2 NAME-2
Platform Linux (or Apple)
Hi, if I have been using windows but have been writing my code in VSC with WSL, should I indicate windows or L...
ANONYMOUS wrote
I mean a lot of the advice given on the forum is based off the project requirements and clarifications Chris made, so it really depends on which advice you are talking about.
A rule of thumb for assumptions is If you make an assumpti...
Is it correct that the syntax assumptions in the report do not have to align with the advice given on this help forum?
Such as if global variables, variable reassignment and parameter checking have already been implemented, they can be listed as assum...
I have a question regarding the project, specifically point 8 within the assignment brief
The variables arg0, arg1, and so on, provide access to the program's command-line arguments which provide real-valued number...
Hello, I just wanted to check if I'm on the right track
The runml.c program
1) reads the .ml text file
2) translates the .ml text into valid C syntax
3) writes the translated C syntax into an output.c file
4) then complies and runs the output.c file
this ...
ANONYMOUS wrote
This is a statement, so yes. pqr will be zero so it won't matter. sas will cause the error, since there are two identifiers followed after each other in a statement, which is invalid syntax.
This is invalid syntax.
program
A program is made up of zero or more program items.
program-item
A program item is either a statement or a function, a function can have zero or more identifiers.
statement
A statement is either an assignment or a pri...
ANONYMOUS wrote
The file is temporary and will be deleted by your program. So, you can name it whatever you want (but make 110 sure the name doesn't and will not collide with other file names when run on other people's computers). However, the reaso...
Hello, i would like to ask regarding the output file (the c file where we translate the ml file to). Do we have to make the output file with the PID included like in the example?
ANONYMOUS wrote
Amitava needs to answer this one.
From project specification
"Your submission will be examined, compiled, and run on a contemporary Ubuntu Linux or macOS platform. Your project only needs to execute successfully on one of these platfo...
Hi Yuxuan
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 ...
ANONYMOUS wrote
Yea that's fine as long as you delete all the files you create.
The only thing that needs to be a single file is the runml program itself.
So I was thinking that my project would be cleaner if I have separate temp files for function definitions, glabal variables and the main function.
At the end I would merge these files, compile and run the final c file and then delete all of them. Jus...
I'm not OP but I don't think it's unreasonable to ask for clarification given that cssubmit still says it's due yesterday. I submitted mine just now and it says it's late with a minus 5 penalty - I assume I won't actually lose 5 , but it's still a b...
In the code provided in sample02.ml, are the variables x and y considered local variables, or can they also be considered global variables?
An assignment statement, 2.500000 is printed
x - 2.5
y - 5
print x
print y
Or are variables only considered glob...
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 in...
Dear Prof. Amitava
Thank you for your reply. I tested 8 samples successfully, but I still have two questions
1. I have passed 8 test cases and printed correctly. The former lecturer mentioned that he would post a web link specifically for testing, ...
ANONYMOUS wrote
Yes, otherwise if you have already done it Amitava said you can state the assumptions you made in a file. So, you can do either, just state what assumption you made.
This is a repost of a previous question https secure.csse.uwa.edu.au run help2002?p np opt U224 , is the following code permitted?
function add a b
return a b
function two
return 2
print add(1, two())
https secure.csse.uwa.edu.au run help2002?p np opt B388 year 2024 do we instead follow this and not allow any duplicate names of variable reassignment now??
This assumption was based off 'you cannot introduce a new function if its name is already used as a variable's name, or introduce a new variable if its name is already used as a function's name.' from https secure.csse.uwa.edu.au run help2002?p np ...
By passing a function as a parameter to another function, I mean
function exec a
return a()
function seven
return 7
print exec(seven)
Here we pass the function seven to the function exec as its a parameter, and the exec ...
ANONYMOUS wrote
multiple declaration of the same variable (name) is an error, you can assume that. We are not overthinking here, make simplifying assumptions, state those assumptions in a file, and you will be fine.
ANONYMOUS wrote
You can add a print statement in the ml file if you want something to be printed. Submit that modified ml file mentioning that you have added a print statement.
ANONYMOUS wrote
I don't understand the source of this confusion. I have sent an email (and you can clearly quote that in case of any dispute) aand what I wrote there is correct. I cannot go on sending emails recursively and validate ad infinitum.
ANONYMOUS wrote
I didn't have much time to look at the project carefully. However, main() is also valid in C, without any parameters like argc and argv
If you want to be 100 sure you can ask Amitava.
You can always do something with var to remove the warning. Literally just do var var 1 and the warning will go away.
ANONYMOUS wrote
Technically they're not considered "identifiers" just "variables". So, in other words, they're an exception to the rule. As stated in the project description
"8.the variables arg0, arg1, and so on, provide access to the program's comm...
okay, so I can assume that the arguments will be accessed under the alias arg0, arg1, .... and not under any other name correct? but wouldn't this contradict the statement where identifier names can only include lowercase alphabetic order?
ANONYMOUS wrote
You are missing something.
You replace the identifiers (in the ml file) arg0, arg1, arg2, etc. By the command line arguments that are passed to run ml. e.g.
. runml somefile.ml 1 2 3
means that in the ml file the parameters will be initi...
ANONYMOUS wrote
Why can't the same identifier name be reused? After the function ends the program would believe it is seeing the identifier for the first time and so would initialize it to 0.
ANONYMOUS wrote
I believe Chris said either in the forum or the project sheet that all statements must start at the lefthand most side of the file unless it is a statement in a function.
Not sure where a comment could appear (because technically comme...
It would. Or you can write an if statement in the c version of the ml file to change what is printed, then let c do the hard work.
That would make the most logical sense. Since warnings can be errors and do something unintended.
No guarantees about the...
Yes, I forgot there are no "if" statements in ml, because there are no "if" statements, it would run forever. So, don't worry about recursion. Can't see the point in testing an infinite loop.
right, I understand that the temporary C files can just be encapsulated like so (correct me if i'm wrong)
c
int main(int argc, char argv )
converted c code here
but that doesn't really explain how the program can access the arguments, a...
Q1) I saw the thread that you shared but it means that we will have to store the expression, evaluate it and then handle the value. something like -
double temp entire expression ;
if (temp int(temp)) ....
Q2) So if i understand correctly, the expe...
once we finished transcribing the ml language into C code in a separate file, I assume we need to call the system function to run shell commands to run the C file right?
the problem with this is that we require a main function for it before it compile...
Hi, currently I have all the functions double in the translated c file and it works fine even if the function doesn't have a return statement.
I read that the return value is undefined for such functions in c so I just wanted to confirm that the retur...
Hi, Thanks for replying I have another question, if comment is inside a function definition does it have to start with a tab character?
My question was more about if I can completely rely on the tab character to mark the end of function definitions.
ANONYMOUS wrote
Hey guys, ml accepts whole numbers, there is no example in the ml file where there is a decimal point after a whole number, e.g. 2.0 would just appear as 2 in the ml file. I'm assuming as more decimal places are required they will be ...
You wouldn't need to check mismatched brackets as Chris said expression checking isn't necessary.
Yes, if 24.00, print as 24. if 24.5, print as 24.500000
Not sure but better to be safe than sorry and assume it can be as deep as it is in C.
Hi Trisha,
Sorry for the delay.
If no clarification is given, better to be safe than sorry and assume it is possible. This functionality is allowed within the ml syntax.
Identifiers and functions shouldn't have the same name.
Syntax of ml allows this. You should be able to just copy the function call into c and it would work.
You need to change the format string of printf so that you print the double without any decimal places. Answered here
https secure.csse.uwa.edu.au run help2002?p np opt U245 hl integer
I would say so. Some warning in C are straight up errors and res...
ANONYMOUS wrote
Hi I don't believe empty lines are allowed in ml, all the sample files have no empty lines and instead use a comment to create an "empty" line.
ANONYMOUS wrote
Depends on whether the function returns a value or not. You could just always have the function return a double and just add return 0.0 to the end of the function if there is no return value.
ANONYMOUS wrote
If the ml file prints then the correct output should appear in the terminal. The ml file should throw an error if there a syntax error in the ml file. Likewise the ml file should correctly run and not throw an error if there are no er...
While the project will revert to its 20 contribution to our final grade, will the deadline be changed to the 20th as stated in the email, or will it maintain its original deadline on the 13th as well?
I apologise for repeatedly asking, but I still need a more specific clarification regarding this case. The line 'Whitespace can only appear at the beginning of a line if it is a tab under a function definition' is said to be true but whitespace and t...
Hi,
Could you please guide me on to define the tests whether successful?
Just output like the picture shows or should they print the number as each sample writes?
Which one is standard?
Hope for clarification
If the line in the mlfile reads function abc
Should it be returning 0.0?
Or is the return type void?
Meaning I would be writing void abc()
to the temp file?
Hello,
I've just posted another article, but thought I should separate these for clarity.
First of all, similar questions have already been asked in my article (https secure.csse.uwa.edu.au run help2002?p np opt B275 year 2024) as well as this art...
Hello
I have a few questions about expressions- best set up with a few excerpts from the project document. In section 4 of project requirements the following is said
"your program will not be tested with any invalid expressions, so you do not ne...
As the ml syntax outlines here, a function can have a statement which can be a function call
program-item
statement
function identifier ( identifier )
tab statement1
tab statement2
...
Hello,
This makes sense, but what if the variable is used again outside of the scope of the function?
function func a
problem - 3
return a problem
problem - 5
print func(problem)
The above example would work with a result of 8, with problem bein...
Hi,
1. What is the expected behaviour when someone declares 2 functions of the same name, should the program report an error or replaces the function?
2. What if it has 2 different parameters but same name?
Example 1
function increment value
return va...
Hi, am I correct in assuming that the variables arg0, arg1, and so on can only appear in expressions?
In other words, this is ok
x - arg0 2
but this is not ok
arg0 - 2
function process arg1
do something
Thank you
Hi Zexu,
"7.variables do not need to be defined before being used in an expression, and are automatically initialised to the (real) value 0.0"
"12. a function's parameters and any other identifiers used in a function body are local to that function, an...
Hello,
How am I supposed to treat new identifiers? As mentioned, a new identifier doesn't need to be initialised explicitly, however, at the same time, the variable will be invisible out of the function area. So should I treat a as a new variabl...
ANONYMOUS wrote
"4.only a single datatype is supported - real numbers, such as 2.71828"
All parameters will be real numbers (doubles) as that is the only datatype supported.
If an expression that is not a print is not inside a function's scope, would it be in the global scope? And if the print is outside of a function's scope, would it be located in the main function?
For example, the ml file
9 is printed
one - 1.555
on...
Hi,
Just a few questions about functions
What should happen if a top level variable shares the same name as a function? Is this disallowed by ml like it is in C?
Also, is it possible to pass a function as a parameter to a function, if it is, how would ...
Hello,
Section 4 of the project requirements (https teaching.csse.uwa.edu.au units CITS2002 projects project1.php) says that
Which makes sense- but how far does not being tested with "invalid expressions" go? Can we assume that all functions that a...
Theoretically the language description limits it to 49; there's a maximum of 50 unique identifiers per file, and so if you had a single function there would be 1 identifier for the function name and a maximum of 49 for the function parameters.
Althoug...
np.
It is this bit "Otherwise, whitespace can (but doesn't need to) appear anywhere else"
In other words, both ways of calling the function as you have shown above are correct. A function call can have white space but doesn't need to have white sp...
When it means checking the syntax, do we have to check for all cases,
eg if we have a comment in the middle of a print call
print incre ment(3) increment(4)
TIA.
Thank you very much This is useful information- though I still am a bit stuck until the first question is answered...
I would also appreciate further clarification on the link in your answer (https secure.csse.uwa.edu.au run help2002?p np opt U14...
ANONYMOUS wrote
I feel you are reading too deeply into that section of that paragraph. If you continue reading
"The strategy is to first translate programs written in other languages, such as our ml, to C, to compile that translated C code using a st...
I have seen this sentence in the project sheet "Writing a compiler for any programming language is an enormous task, clearly not one suited for this project. However, what many have recognised, is that C is an excellent language to support other lan...
Hi, Chris mentioned there will be a webpage where you can put the code in and you can see whether it matches with the sample solution. Just wondering when will it be released.
Hi Harrison
Sorry for the delay, unfortunately, there's been sudden changes to the teaching staff, so I have to wait for the new unit coordinator to clarify these questions.
Answered here https secure.csse.uwa.edu.au run help2002?p np opt U201
perr...
Hello,
My first question is one which is halting me and has already been posted about a few times ( here (https secure.csse.uwa.edu.au run help2002?p np opt B243 year 2024) and here (https secure.csse.uwa.edu.au run help2002?p np opt B240 year 20...
1. What is the maximum number of parameters a function can take in? I do not see it anywhere in the project page.
2. Is it safe to assume that functions with no parameters will automatically be void functions?
ANONYMOUS wrote
Honestly it would be very hard to tell if a statement is meant to be in a function but it isn't. Since ml syntax allows statements to be inside or outside a function, there's no way of telling if they belong to a function if they aren...
each statement in a function's body (one-per-line) is indented with a tab character
So for this, we don't need to check if its indented and return a syntax error, we just say that if the line isn't indented then we aren't in a function anymore.
Consider the following ml code
one - 1
two one 1
function add val
print two val
The variable two declared by assigning the result of an expression to it, and is accessed in function add , it should be a global variable to allow the ac...
ANONYMOUS wrote
There are no guarantees what the last statement in a function will be, it could return, it could print, or it could be another statement (the syntax of ml allows this). So, relying on seeing a particular statement to know if the funct...
ANONYMOUS wrote
You do not need to display the comments in the c file. Since the c file gets deleted anyway. So, when you come across a comment in ml you can just ignore it.
How can we determine when a function body should end if not every function requires a return statement?
The sample code with no return in the function body happens to end with a print statement, is this the only alternative to a return statement for ...
Hi,
Does this mean whitespace is only significant when it is at the beginning of a line but still insignificant anywhere else (except when 1 whitespace minimum is necessary)? Therefore, any line beginning with a whitespace would cause an error (inclu...
so, i saw that in the steps to run and execute ml files, we basically turn the ml file into a c file, compile it, and execute the program.
However, it also says to delete the c file and executables after running a program, so does it even matter if i ...
Ok let me try writing this out again, since half of my response got deleted. When you run your program like so
. runml sample.ml
runml (your project) will read the ml file given as the first parameter (in this case sample.ml), it will validate th...
ANONYMOUS wrote
Hi anon, I'm not 100 sure what you are asking but when you run your program like so
. runml sample.ml
runml (your project) will read the ml file given as the first parameter (in this case sample.ml), it will validate the m...
For compiling
The program should validate the syntax
Generate the code in a .c file
Do you then run . runml sample08.ml and then it should automatically delete the .c file
and the compiled file as well?
ANONYMOUS wrote
Hi anon, I believe your question in answered in these two posts
https secure.csse.uwa.edu.au run help2002?p np opt U145
https secure.csse.uwa.edu.au run help2002?opt U132
Yes, that would break my cool idea. However, we can still fix it, just keep track of the quotes too. If we saw a quote ignore everything until we see another quote.
Unfortunately, ml only supports real numbers, which makes me sad as this circumstance ...
Oops Directly after posting I saw this article (https secure.csse.uwa.edu.au run help2002?p np opt B240 year 2024) which is very similar... So now I'm only really looking for an answer to the empty braces question
what happens when the function takes a string as a parameter and the string contains bracket and commas? e.g. call function("This will break, your idea (maybe?)")
Hi,
For the ml sample files given are used as comments (unless I'm mistaken). If this is the case, then will our code be tested against files that contain strings that can also include hashtags or are our files strictly tested against ml files that ...
Hi just wondering how specific the error messages should be should they return the full reason for error like "Function name is too long" or can the be as generic like "Function name invalid".
Hello
I'm currently working on functions and have two questions
- Should attempting to print a function with no return yield a 0 or an error
- Does a function with no inputs use empty brackets when called
For example, take the ML code
x - 1
y - 2...
He did specified 300 lines of important code, as in not including whitespaces, braces, includes, etc, so make sure you aren't counting those in your own line count.
I highly doubt there will be penalties for too many lines though. The rubric certain...
My partner and I are basically done but we have almost hit 500 lines and can't find anything to remove that isn't necessary. Chris mentioned that anywhere close to 300 lines is over the top so 500 is a bit of a worry.
1) has anyone managed to keep it ...
The description of ML allows for functions to have no return statements. If I have a function like
function noreturn a b
print a b
print 1 noreturn(1, 2)
Obviously the inner print will print 3, but what about the outer print? Is it expecte...
Hi Guys,
Sorry about the delays replying. Some questions about project requirements are really good so I need further clarification (from teaching staff) before I can respond (I don't want to make the project too hard). So, for now if you are unsure o...
I should also mention you'd likely need to recursively "check" functions, e.g. If you're checking the parameters and encounter another function, start checking the new function.
But like I said I'm not sure if it is necessary.
I'm not sure if it is necessary but it does sound like fun (if you're me anyway).
You could check the number of arguments by counting the number of commas and the number of open brackets without a closing bracket. If number of open brackets is 1, then...
Do I need to consider the possible mismatched brackets? Like
text
func((1 2, foo)
Am I supposed to use d or f according to the different return values of the expression?
And what is the maximum recursive depth of the expression?
t...
Thanks, I understand that is an option, but I do want to know whether the language actually permits passing references to functions, because the syntax guide suggests it does, and the language description doesn't seem to forbid it.
Instead of passing a function to another function, the first function can just be evaluated in the parameter expression like this
function add a b
return a b
function two
return 2
print add(1, two())
Hi, I have the following questions about the project
1. Can we assume that a function must always have at least one statement in its body so if a function has no body (i.e. no indented statements) we should report this as an error?
2. If there are mor...
Hi, wanted to know if variable reassignment is a possibility we have to look for in the assignment. E.g.
x - 12
x - 5
print x
Thank you.
This is a repost of a previously untagged question.
If we pass a function into another function as an argument, is it expected that we can call it, or should it be treated as an un-declared variable, ie 0?
function add a b
return a b()
function two
return 2
print add 1 two
Should this produc...
Hi
Functions don't always have a return statement (see sample05.ml). Your other question in this post https secure.csse.uwa.edu.au run help2002?p np opt U145
Hey Guys, sadly I am not the prof, but I believe your questions are answered by the following posts
1. https secure.csse.uwa.edu.au run help2002?p np opt U145
2.https secure.csse.uwa.edu.au run help2002?opt U132
That would be hard to do without building a full-blown syntax parser, how would you figure out how many parameters are in this function call
function name((x 1)-2, function2((a-1),b))
Ok wow - the markdown is a bit different to what I am used to using. Lets try that again because there doesn't seem to be a way to edit my post
Working code
2 is printed
3 is printed afterwards
value - 1
function increment
value - value 1
...
Hey,
Thought we could share interesting and weird ml code to test our work. Here is one I came up with
mlcode
2 is printed
3 is printed afterwards
value - 1
function increment
value - value 1
Function call with parens right against the na...
Should there be an explicit condition check where the number of arguments passed in a function call matches the number of formal parameters in the function definition?
I think they are definitely legal statements. Maybe the only illegal ones are
function - 1
or
print - 1
Because both print and function are reserved keywords, they are not supposed to be used as variable name.
Hello Thank you for explaining
I still have a question. Does this mean that there shouldn't be any " " t t m n s i h f i i l s b i s o i c t i o o r o n d b g i g r i ' k y t u m t w t o t r m v n h e u g n t t m n s a o g...
Is it correct to assume that return can only be used within a function and every function must have a return statement (so a return statement will always denote the end of a function body)?
following on with this question
1. In the cases where 1 whitespace minimum is required (such as after function, return, print, between the function identifier and its parameters), can more whitespace be added without causing any error?
2. Can whitespa...
Hey, I'm not Chris, but I believe that the description of function declarations found under the ml syntax guide allows this.
These two lines specifically are relevant
(...) means zero or more
function identifier ( identifier )
In the sample05.ml
18 is printed
function printsum a b
print a b
printsum (12, 6)
Are there any differences between printsum (12, 6) and printsum(12, 6)?
Hi, just wondering if empty functions, e.g
function numbers
print 1
print 2
print 3
numbers ()
is possible in .ml, or if functions require parameters to be passed through them, as shown in the rest of the sample.ml files.
Could we make this more clear or simplified? If we accept any representations, the situation may be a little bit complicated
1. "1.5e4F" - Some characters like ".eF" must be grabbed when tokenizing a real number.
2. "- 4" - A space-separated minus m...
ANONYMOUS wrote
Thanks for highlighting this omission.
It's now correctly stated on our Clarifications' page https teaching.csse.uwa.edu.au units CITS2002 projects project1-clarifications.php
In one of the other help questions it was stated that
HI am a little confused as to why it'll be arg0, arg1, ... as in the project "The goal of this project is to implement a C11 program, named runml, which accepts a single command-line argument provi...
Any clarifications about it, like a BNF? The syntax of float point value in C is more than numbers and a dot, as the link below shows. Thanks a lot.
https learn.microsoft.com en-us cpp c-language c-floating-point-constants?view msvc-170
I'm unsure of the acronym PEMDAS (suspecting it has the same meaning to the one I know, which is BOMDAS).
As you do not have to check the validity of the expressions, you do not have to check or 'handle' the precedence of operators.
ANONYMOUS wrote
Syntactic errors in an ml program should be reported on a line beginning with a ' ', such as unrecognised statement
They are different to any other debug statements that you wish to print out, such as n w i u c i n...
Hi, my partner and I were wondering as all samples provided only involved basic mathematic notation
Will we ever get .ml files with more complicated notation that requires the use of PEMDAS, for example 1 7 6 3, which should equal 15 with PEMDA...
ANONYMOUS wrote
Thanks for the question; I'll clarify the wording.
When you find the first error (if there is one), print your error message and then terminate exit your runml program.
The project requirements state that we need to catch usage errors and syntax errors. While it is stated that syntax errors must be reported to stderr beginning with a " ", I'm not sure what the following " " h r c e o e u r n i g i e e r n ...
Hello Josiah,
You appear to missed a significant amount of understanding about the project.
Your program, runml , will transpile translate convert a small ml program into a C11 program (creating a new text file to hold that C11 program).
That C11 p...
The description says our program should check for "any" errors, and also that "all errors" should be reported through stderr stream. Does this mean even after finding one error in the file we should continue to search for more? Or just that all erro...
Reading the part in the Project 1 page that says ... "runml generates C11 code in a file named, for example, ml-12345.c (where 12345 could be a process-ID)", what C11 code is this referring to? Is it just some arbitrary code or something that we have...
ANONYMOUS wrote
There shouldn't be any issues, in that there's no OS-specific features requirements in the project, and both Linux and macOS support all of the necessary POSIX functions.
My friend and I had decided to do the project 1 together. However, she uses Mac os while I use ubuntu. Will we still be able to do the project together without facing any issues?
ANONYMOUS wrote
You do not need to validate expressions, thus you do not need to detect or report an error as in x - double 2
However, you will need to locate any identifiers within expressions, such as double above, - depending on y...
The project description states that
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 progra...
Hi Chris,
I was wondering how we will be receiving command line arguments for our ml programs. The specs say that only the path will be passed to our runml program, but later it says that we may be passing command line arguments to our generated c pro...
ANONYMOUS wrote
Your understanding is the wrong way around. An ml function must be defined before it can be called.
The C code generated by your runml program should not have any C syntax errors, so the C compiler should not find or report any err...
ANONYMOUS wrote
No - you cannot introduce a new function if its name is already used as a variable's name, or introduce a new variable if its name is already used as a function's name.
Parameters are passed as they are in C. A copy of an actual param...
A good question (but, unfortunately, something I was hoping would be recognised as something that "should be done", rather than "must be done").
Yes.
The ml variable arg0 'comes from' C's argv 1 , as the C program's name is unlikely to be a...
Thank you for the clarifications.
My question about argument checking was poorly worded. It is clear to me that runml should perform argument checking, what I meant to ask was whether the ml scripts compiled by our program should perform argument chec...
Hi, I was wondering if some of the syntax checking can be left for the c compiler to handle.
For example, As I understand the requirements, we don't need to check if functions are defined before being called, since the c compiler will check and repor...
Hi, my project partner and I have just had a discussion and came back with a few questions assumptions that we wanted to check about the syntax of ml.
1 .Is it possible to have cases where functions and variables in ml share the same identifier while ...
Not quite sure of the context of this post.
The intention is to not make any changes to the project description once it is finalised (as it was very early this morning, and announced in an announcement on this forum).
Any necessary changes from now w...
Hello,
The focus of the project is not on designing and fully implementing a mini-language - it's 'only' about performing a quite mechanical syntactic translation from one language to another (C11), compiling, and then executing the program. The goal...
Do not know it is a proper way to let everyone know content changes of the project description.
Update timestamps let everyone know whether the content has changed or not since the last time they checked out (if they still remember the date).
Change lo...
Regarding whitespace, can I assume the following?
- Whitespace can only appear at the beginning of a line if it is a tab under a function definition
- Whitespace must appear between words in print expression , return expression , and function identi...
Hi, Just had a few questions about the assignment.
First, what should happen if divide by zero occurs, are we expected to do static analysis at compile time, throw an error at run time, or is it UB?
Second, in example 5 a function call is done using ...
Hi, I was wondering if any examples of programs written with the .ml format will be available later?
This would aid in understanding and translating the language.
The 1st project description is now finalised.
Please post requests for clarification about any aspect of the project to help2002 so that all students may remain equally informed.
Significant clarifications and corrections will be also added to the proj...
Very sorry, but I'm going to reverse my decision on this point (to make it easier for all to implement)
All statements and function prototypes (1st line) must begin at the left-hand-margin (column 1).
The statements forming a function's body must ...
ANONYMOUS wrote
Yes, BUFSIZ (8192 on Linux, 1024 on macOS) is a suitable choice for your maximum line length.
You should write your own test programs, and not rely on a finite number of sample cases.
There will be a webpage to which you can enter your ...
Hi,
I was wondering roughly what size input we should expect to process in the text files; would it be appropriate to use BUFSIZ in fgets as shown below? (example from lecture 7)
FILE dict;
char line BUFSIZ ;
dict fopen( ..... );
while...
Hello,
The project specification is not quite finished, yet, but ...
The language's syntax does not permit nested functions https teaching.csse.uwa.edu.au units CITS2002 projects project1-syntax.php
Functions are introduced with the 'function' keywor...
Hi, Professor.
I have some questions about project 1.
Should we consider about nested function and higher-order function?
function create multiplier factor
function multiplier x
return x factor
return multiplier
double - create multiplier(2)
print ...
No, it has not been released yet. My current focus is tomorrow's mid-sem test.
When it's released, it will be announced linked in all the usual, obvious, places.