It's UWAweek 42 (2nd semester, week 12)

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.
213 articles posted by this person
Showing 213 of 688 articles.
Currently 13 other people reading this forum.


 UWA week 42 (2nd semester, week 12) ↓
SVG not supported 4:39pm Tue 15th Oct, Joshua N.

Both are correct. The struct you make doesn't need to be exactly the same.


SVG not supported 4:33pm Tue 15th Oct, Joshua N.

ANONYMOUS wrote This isn't correct because we are using the "Local" Least Recently Used (LRU) algorithm to evict processes. You seem to be using "global". 1. At time 0,1,2,3 0 0 0 0 is loaded. 2. At time 4 The fifth zero is ignored. 3. At time 5,6,7,8...


SVG not supported 4:23pm Tue 15th Oct, Joshua N.

ANONYMOUS wrote I believe that's a typo should be ". simulation.c in.txt out.txt".


SVG not supported 4:22pm Tue 15th Oct, Joshua N.

ANONYMOUS wrote You wouldn't gain marks since it isn't asked for in the specification. Whether you lose marks or not would be up to the discretion of whoever marks your code (usually, you wouldn't be marked down for having extra code that exists for ...


SVG not supported 8:50am Tue 15th Oct, Joshua N.

Thanks. Your solution is correct.


SVG not supported 8:47am Tue 15th Oct, Joshua N.

ANONYMOUS wrote Just what is written in the spec. each page table entry on a new line. Followed by the RAM contents with each page semi-colon separated. You also need to explicitly print out the empty slots of RAM (You can just print "empty" for that...


SVG not supported 8:44am Tue 15th Oct, Joshua N.

ANONYMOUS wrote You have to take the page that has not been in the RAM before. So 3.


SVG not supported 9:30pm Mon 14th Oct, Joshua N.

That's right.


SVG not supported 9:28pm Mon 14th Oct, Joshua N.

Thanks for clarifying.


SVG not supported 9:27pm Mon 14th Oct, Joshua N.

Yes. The spec explicitly states the names of the files will be in.txt and out.txt As Anon said it is good practice to be able to read a file of any name as opposed to a hard coded value. However, for this project you can assume that the file name pass...


SVG not supported 9:21pm Mon 14th Oct, Joshua N.

Looks good.


SVG not supported 9:16pm Mon 14th Oct, Joshua N.

ANONYMOUS wrote Last I heard marking is, unfortunately, going very slowly. Hopefully it will be done before the exam.


 UWA week 41 (2nd semester, week 11) ↓
SVG not supported 3:31pm Sun 13th Oct, Joshua N.

All good answered here https secure.csse.uwa.edu.au run help2002?p np opt U545 hl input 20validation


SVG not supported 12:49pm Sun 13th Oct, Joshua N.

ANONYMOUS wrote Hi Anon That's fine. np.


SVG not supported 7:04pm Sat 12th Oct, Joshua N.

The spec doesn't specify the exact format. You would need to ask Amitava to be complete sure.


SVG not supported 7:03pm Sat 12th Oct, Joshua N.

Could you state exactly which part of the specification you are referring to? Or what it said exactly? I can't seem to find it. The spec states "The last accessed time of a page will be the time step when you brought the page to RAM. For example, aft...


SVG not supported 9:36am Sat 12th Oct, Joshua N.

Both seem correct.


SVG not supported 5:32pm Fri 11th Oct, Joshua N.

Answered here https secure.csse.uwa.edu.au run help2002?p np opt U574


SVG not supported 5:32pm Fri 11th Oct, Joshua N.

ANONYMOUS wrote Yes, Amitava said you can either do that or reload the pg 0 again (which would just be updating the "last accessed" variable). I believe moving pointers was the intention, otherwise using an array of pointers to structs wouldn't have a...


SVG not supported 12:28pm Fri 11th Oct, Joshua N.

In general, if you are looking for resources for this unit look on LMS as Amitava can't upload anything on Chris's website.


SVG not supported 12:27pm Fri 11th Oct, Joshua N.

ANONYMOUS wrote Yes. Is there a need to present it in stdout? No.


SVG not supported 8:15am Fri 11th Oct, Joshua N.

ANONYMOUS wrote Yes (although technically you could use an array of size 16 since there are duplicates).


SVG not supported 12:26pm Thu 10th Oct, Joshua N.

ANONYMOUS wrote I don't think so, Amitava never said anything about an assumption sheet for this project. From his email he said to put any assumptions you made as comments in the file you submit. Make sure to put them at the top of the file.


SVG not supported 12:23pm Thu 10th Oct, Joshua N.

ANONYMOUS wrote The specification states that the struct you use "may" look like the one it provides. So, no you don't have to use the exact same struct. However, I do believe you need to use a struct.


SVG not supported 12:20pm Thu 10th Oct, Joshua N.

ANONYMOUS wrote Yes. Global means evict the page in RAM with the lowest "last accessed" time. Local means evict the page from the same process in RAM with the lowest "last accessed" time (e.g. If you are loading process 0 onto RAM and RAM is full and ...


SVG not supported 12:15pm Thu 10th Oct, Joshua N.

ANONYMOUS wrote Amitava needs to clarify. I'm assuming you don't need a ";" at the end. If memory isn't allocated, then how are you able to store anything in your structure? Most likely, it's bad practice to not free dynamically allocated (or malloced)...


SVG not supported 6:37am Thu 10th Oct, Joshua N.

ANONYMOUS wrote Normally half the exam is a writing C code by hand but since Amitava is teaching the unit now that may not be the case. You would have to ask him.


SVG not supported 6:35am Thu 10th Oct, Joshua N.

ANONYMOUS wrote One person submits the simulation.c file with the names of both members in the file as a comment at the top.


SVG not supported 6:34am Thu 10th Oct, Joshua N.

ANONYMOUS wrote Yes. Yes. So the out.txt of the example above should look like this? For the RAM content is it process, page, time stamp; or page, process, time stamp; ? I believe it follows the same order as the struct, which is process;page;last acce...


SVG not supported 6:26am Thu 10th Oct, Joshua N.

ANONYMOUS wrote Yes. Yes. You need to remember the last page you loaded for each process. It's up to you how to determine how to do that. Since RAM is full and there is no page of process 3 on RAM, we can't use local LRU to make room, we need to use glo...


SVG not supported 4:47pm Wed 9th Oct, Joshua N.

ANONYMOUS wrote If you are ignoring the input the time stamp wouldn't increase since you aren't loading it into RAM. I'm not sure how project 2 will be marked. You would have to ask Amitava to know for certain. Projects are usually automatically marke...


SVG not supported 4:43pm Wed 9th Oct, Joshua N.

Yes, if you're assuming you can load the same process twice.


SVG not supported 4:41pm Wed 9th Oct, Joshua N.

ANONYMOUS wrote Not sure, you would have to ask Amitava to know for sure. I don't think it will be larger than 10000 inputs. 0 1 2 3 99 99 99 99 99 99 99 99 99 99 99 99


SVG not supported 6:40am Wed 9th Oct, Joshua N.

Yes, Virtual Memory doesn't change. We are just moving pointers in and out of RAM (and updating the page table to keep record of where the pages are in RAM). np


SVG not supported 6:37am Wed 9th Oct, Joshua N.

Simulations are a model or abstraction of the "real world", they do not 100 match what is done in practice. How much a simulation matches the real world depends on the level of detail necessary (as per the specification). With all simulations you ne...


SVG not supported 4:21pm Tue 8th Oct, Joshua N.

ANONYMOUS wrote Answered here https secure.csse.uwa.edu.au run help2002?p np opt U564 Their contents are not disjoint (e.g. for the example you gave, after the first-time step the pointer for page 0, process 0 will be in both RAM and Virtual Memory)...


SVG not supported 2:08pm Tue 8th Oct, Joshua N.

There will be a maximum of 8 pages in RAM. It does make sense. You can identify a specific page by its process id and page number. Why will there need to be 2 different processes in RAM? Technically a page from each process can be in RAM. Unless you ar...


SVG not supported 7:05am Tue 8th Oct, Joshua N.

ANONYMOUS wrote It can be initialized sequentially. So long as the disk starts with all the process pages inside. So, 0-3 pages for each of the 0-3 processes. Yes, as the spec states if a page of a process isn't in RAM its entry in the page table is 9...


SVG not supported 7:16pm Mon 7th Oct, Joshua N.

If you mean RAM is full and you are trying to load a new page onto RAM, so you need to use LRU algorithm to make room then yes. I mean the program will still output what it is meant to (it will still work) but I'm not sure if Amitava will be fond of t...


SVG not supported 7:13pm Mon 7th Oct, Joshua N.

Occurs when RAM is full and you are trying to load a new page into memory. E.g. If page 0 of process zero is in memory and RAM is full and you are trying to load the next page of process 0, then you evict the least recently loaded page of process 0 (...


SVG not supported 2:47pm Mon 7th Oct, Joshua N.

I meant to say "hello world" four times.


SVG not supported 2:45pm Mon 7th Oct, Joshua N.

ANONYMOUS wrote Answered here https secure.csse.uwa.edu.au run help2002?p np opt U417


SVG not supported 2:45pm Mon 7th Oct, Joshua N.

You have no idea what is in stdout when you call print. When you call print the buffer is "flushed" everything inside of it comes out. So, there no guarantee that the result will always be print 4 times. As the correct answer said "The form of out...


SVG not supported 2:01pm Mon 7th Oct, Joshua N.

This is really hard to read and hard to know what question you are asking. I mean for one, your output doesn't print empty slots. It also doesn't print the same slot twice. The structure for some reason has 99 in it? 99 should only be used in the page...


SVG not supported 1:54pm Mon 7th Oct, Joshua N.

RAM starts empty. You only load processes based on the file. At instruction 0, there is no process to evict. Since the RAM is empty. Amitava said a process can only be loaded once. So, the fifth 0 would be ignored. I think that was a mistake on Amitava...


SVG not supported 1:50pm Mon 7th Oct, Joshua N.

ANONYMOUS wrote You would just ignore all lines except the first. However, best practice is to stop processing the file if you detect multiple lines since you would assume the file was corrupted.


SVG not supported 1:46pm Mon 7th Oct, Joshua N.

ANONYMOUS wrote Depends on Amitava. I would guess, based on the specification that there wouldn't be a trailing ";", since its only purpose is to separate the locations.


SVG not supported 1:44pm Mon 7th Oct, Joshua N.

ANONYMOUS wrote Cyclically, so it would be Page 3. Amitava said you can only load the process once, so there would be no next page. Yes.


SVG not supported 1:36pm Mon 7th Oct, Joshua N.

Yes. Yes.


SVG not supported 1:35pm Mon 7th Oct, Joshua N.

ANONYMOUS wrote If Amitava said to only do it once then follow what he said.


SVG not supported 1:34pm Mon 7th Oct, Joshua N.

ANONYMOUS wrote That is the spec unless Amitava changes it. The output doesn't really "show" the default time anyway. Since you only print the times of pages that are loaded onto RAM.


SVG not supported 1:31pm Mon 7th Oct, Joshua N.

ANONYMOUS wrote Yes. I believe you still have to print "Empty" unless Amitava clarifies. I wouldn't say so since the spec states to print the contents of RAM, which would include the empty slots.


SVG not supported 1:29pm Mon 7th Oct, Joshua N.

ANONYMOUS wrote Hi, Amitava can't access the lab sheets on Chris's website. So, I'm not sure if there will be anymore lab sheets. If there are he will upload them to LMS.


 UWA week 40 (2nd semester, week 10) ↓
SVG not supported 1:40pm Fri 4th Oct, Joshua N.

ANONYMOUS wrote Answered here https secure.csse.uwa.edu.au run help2002?p np opt U545


SVG not supported 7:39am Fri 4th Oct, Joshua N.

Correct


SVG not supported 7:39am Fri 4th Oct, Joshua N.

Yep, that is correct.


SVG not supported 6:50pm Thu 3rd Oct, Joshua N.

Actually the best practice is to never call "exit" because it doesn't end the program "gracefully". The best practice is to return EXIT FAILURE (1) in main. If you are interested.


SVG not supported 6:47pm Thu 3rd Oct, Joshua N.

If you encountered a number outside of 0-3 then you would assume the file is corrupted and you shouldn't continue reading. So best practice is to print an error message then call exit(EXIT FAILURE).


SVG not supported 6:46pm Thu 3rd Oct, Joshua N.

If you countered a number outside of 0-3 then you would assume the file is corrupted and you shouldn't continue reading. So best practice is to print an error message then call exit(EXIT FAILURE).


SVG not supported 2:42pm Thu 3rd Oct, Joshua N.

Yes that seems right. just remember that Disk has all 16 pages in it (4 for each process) and disk is never changed. Also RAM has frames 0-7. Processes have pages 0-3.


SVG not supported 8:18pm Wed 2nd Oct, Joshua N.

I've answered this question here https secure.csse.uwa.edu.au run help2002?p np opt U516


SVG not supported 8:16pm Wed 2nd Oct, Joshua N.

You need to make your own tests and see if your program produces what you expect given the project specification. I've given one example here https secure.csse.uwa.edu.au run help2002?p np opt U525


SVG not supported 8:15pm Wed 2nd Oct, Joshua N.

I'll just change the output to avoid confusion. Shame there is no edit option on the forum 0 99 99 99 1 99 99 99 2 99 99 99 3 99 99 99 0,0,0;0,0,0;1,0,1;1,0,1;2,0,2;2,0,2;3,0,3;3,0,3;Empty;Empty;Empty;Empty;Empty;Empty;Empty;Empty;


SVG not supported 8:13pm Wed 2nd Oct, Joshua N.

I think this is meant to be a simple project. So, I don't think input sanitization is necessary, but it is good practice.


SVG not supported 11:38am Wed 2nd Oct, Joshua N.

ANONYMOUS wrote It's going to take a while. Hopefully before the exam.


SVG not supported 6:28am Wed 2nd Oct, Joshua N.

Isn't this your page table? process 1 0,1,2,3 process 2 4,5,6,7 process 3 99,99,99,99 process 4 99,99,99,99 It's hard to follow what you are doing to RAM and disk because it doesn't provide information as to which page of which process is in RAM. RAM ...


SVG not supported 6:20am Wed 2nd Oct, Joshua N.

ANONYMOUS wrote See here https secure.csse.uwa.edu.au run help2002?p np opt U516 Gave an example of output here https secure.csse.uwa.edu.au run help2002?p np opt U525


SVG not supported 8:28pm Tue 1st Oct, Joshua N.

When constructing your array of pointers to structures did you make sure to malloc memory to them before accessing their contents? Segfault means you are going out of bounds in memory. If malloc wasn't used the pointer points to nothing (no memory) s...


SVG not supported 8:26pm Tue 1st Oct, Joshua N.

Are you asking if there are any pages in RAM when the simulation starts? The RAM is empty there are no pages in RAM.


SVG not supported 8:22pm Tue 1st Oct, Joshua N.

I'm not sure what your question is about. Are you asking what happens if RAM is full and we are bringing in another process which isn't in RAM? In that case you would evict the page of any process with the lowest "last accessed" time. Also, not sure ...


SVG not supported 8:05pm Tue 1st Oct, Joshua N.

ANONYMOUS wrote Also, I should mention the contents of RAM I did was incorrect. The first digit should represent the process and the second should represent the page but I accidently did it the wrong way around.


SVG not supported 8:03pm Tue 1st Oct, Joshua N.

ANONYMOUS wrote There is a specific format. Pretty much the one I provided. Except for the empty sections of the RAM because it isn't specified in the spec what should be printed if RAM is empty. Amitava would have to clarify.


SVG not supported 8:13am Tue 1st Oct, Joshua N.

I forgot Amitava changed the spec, should be 0 99 99 99 1 99 99 99 2 99 99 99 3 99 99 99 0,0,0;0,0,0;0,1,1;0,1,1;0,2,2;0,2,2;0,3,3;0,3,3;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;


SVG not supported 8:12am Tue 1st Oct, Joshua N.

ANONYMOUS wrote The updated page table and RAM. 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0,0,0;0,0,0;0,1,1;0,1,1;0,2,2;0,2,2;0,3,3;0,3,3;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0;0,0,0; See here https secure.csse.uwa.edu.au run help2002?p np opt U515


SVG not supported 9:24pm Mon 30th Sep, Joshua N.

ANONYMOUS wrote You should have 4 pages in RAM. I'm not sure if I understand your question but if you exceed the number of pages for a process you likely would need to evict the first loaded page for that process and replace it with the new process. I...


SVG not supported 9:18pm Mon 30th Sep, Joshua N.

Hi Leran, I'm sorry but I think you need to make your own. You can use the example given in the project specification as a guide.


SVG not supported 9:17pm Mon 30th Sep, Joshua N.

ANONYMOUS wrote Yes. That is always what is done when submitting group projects.


SVG not supported 9:16pm Mon 30th Sep, Joshua N.

Each process has exactly 4 pages in VMEM which can be loaded to RAM. Memory of struct pointers. When you store the pointers in VMEM you are storing the structs there also. From the in.txt file you know the process to load onto RAM. You load the ne...


 UWA week 39 (2nd semester, week 9) ↓
SVG not supported 2:03pm Wed 25th Sep, Joshua N.

I C what you mean. I think it's a typo, I think it is just 4 processes. Otherwise, the size of virtual memory wouldn't be enough to store all the processes. To be certain Amitava would need to clarify.


SVG not supported 2:01pm Wed 25th Sep, Joshua N.

ANONYMOUS wrote Hi, I assume so, since that's what the project sheet said. np.


SVG not supported 2:00pm Wed 25th Sep, Joshua N.

ANONYMOUS wrote The project sheet states you "can" work as a group. So, I'm assuming that means it's fine if you work alone. Project is definitely small enough to do on your own.


SVG not supported 1:52pm Mon 23rd Sep, Joshua N.

ANONYMOUS wrote I would say so but to be 100 sure I recommend checking with Amitava.


SVG not supported 1:51pm Mon 23rd Sep, Joshua N.

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...


 UWA week 38 (2nd semester, week 8) ↓
SVG not supported 10:56pm Sat 21st Sep, Joshua N.

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.


SVG not supported 9:43pm Fri 20th Sep, Joshua N.

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.


SVG not supported 9:42pm Fri 20th Sep, Joshua N.

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.


SVG not supported 12:18pm Fri 20th Sep, Joshua N.

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...


SVG not supported 9:53am Fri 20th Sep, Joshua N.

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


SVG not supported 7:26am Fri 20th Sep, Joshua N.

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...


SVG not supported 6:58am Fri 20th Sep, Joshua N.

Wait ".o" is an object file not an executable. You aren't compiling it correctly.


SVG not supported 6:58am Fri 20th Sep, Joshua N.

Perhaps you're not using the right command to compile it? Is the command exactly the same as what you are writing to the terminal?


SVG not supported 6:54am Fri 20th Sep, Joshua N.

Are you compiling on Linux or mac? Do you mean manually compiling and running the file or do you mean manually just running the file?


SVG not supported 10:26pm Thu 19th Sep, Joshua N.

Just make sure to convert argv 1 to a double.


SVG not supported 10:24pm Thu 19th Sep, Joshua N.

Yes. That is the only thing you need to check. If you see a variable, you don't recognize you must replace it with 0.


SVG not supported 10:22pm Thu 19th Sep, Joshua N.

Yea Amitava said you can do it anyway you want. So long as runml.c is compiled with -Wall, -Werror, etc.


SVG not supported 10:21pm Thu 19th Sep, Joshua N.

Could be anything. Need more information. A common error is people don't pass the correct path to the file in execv or system. So, they try to compile a file that "doesn't exit" and so compilation fails.


SVG not supported 10:20pm Thu 19th Sep, Joshua N.

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.


SVG not supported 10:15pm Thu 19th Sep, Joshua N.

This is a reasonable assumption. Make sure to put it in your assumption doc.


SVG not supported 10:14pm Thu 19th Sep, Joshua N.

Amitava said you can do either. For unused variable multiply the variable by 1 and the error goes away.


SVG not supported 10:12pm Thu 19th Sep, Joshua N.

ANONYMOUS wrote Usually, it's just one person. Amitava would have to clarify.


SVG not supported 5:35pm Wed 18th Sep, Joshua N.

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 ...


SVG not supported 5:30pm Wed 18th Sep, Joshua N.

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 ...


SVG not supported 5:27pm Wed 18th Sep, Joshua N.

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.


SVG not supported 5:26pm Wed 18th Sep, Joshua N.

Answered here https secure.csse.uwa.edu.au run help2002?p np opt U275 hl white 20space


SVG not supported 5:24pm Wed 18th Sep, Joshua N.

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...


SVG not supported 11:16am Wed 18th Sep, Joshua N.

ANONYMOUS wrote Amitava said to use 'cc -std c11 -Wall -o output output.c'.


SVG not supported 9:51am Wed 18th Sep, Joshua N.

ANONYMOUS wrote Don't need to validate y 2 since it is an expression, but you do need to validate the assignment.


SVG not supported 6:43am Wed 18th Sep, Joshua N.

ANONYMOUS wrote Option d is wrong. You just had a lucky number choice where the result is the same. If you first divide by ten you perform integer division and so the result becomes 2409, modulo 100 gives 09, which is 9 in this case. A is correct. modu...


SVG not supported 6:22am Wed 18th Sep, Joshua N.

You don't need to do this. The arguments are "passed in" into the variables arg0, arg1, etc. This is what you are meant to do. np


SVG not supported 8:31pm Tue 17th Sep, Joshua N.

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.


SVG not supported 5:01pm Tue 17th Sep, Joshua N.

ANONYMOUS wrote WSL stands for "Windows Subsystem for Linux". So Linux.


SVG not supported 3:37pm Tue 17th Sep, Joshua N.

Just multiply x by 1 in the code. e.g. x x 1; and the error warning will go away.


SVG not supported 3:34pm Tue 17th Sep, Joshua N.

Maybe my answer to this question will answer your question https secure.csse.uwa.edu.au run help2002?p np opt U344 hl arg0 Let me know.


SVG not supported 3:30pm Tue 17th Sep, Joshua N.

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...


SVG not supported 3:19pm Tue 17th Sep, Joshua N.

ANONYMOUS wrote Seems good so far. Just make sure to delete the output.c file and the executable when you are done.


SVG not supported 5:35am Tue 17th Sep, Joshua N.

ANONYMOUS wrote Answered here https secure.csse.uwa.edu.au run help2002?p np opt U278 hl website


SVG not supported 5:35am Tue 17th Sep, Joshua N.

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.


SVG not supported 8:33pm Mon 16th Sep, Joshua N.

ANONYMOUS wrote Hi sorry, you are right. I misread what he said. Thanks for letting everyone know.


SVG not supported 5:32am Mon 16th Sep, Joshua N.

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...


SVG not supported 5:23am Mon 16th Sep, Joshua N.

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...


 UWA week 37 (2nd semester, week 7) ↓
SVG not supported 2:22pm Sun 15th Sep, Joshua N.

ANONYMOUS wrote Write them to the file into their respective identifiers. E.g. arg0 is argv 2 assumption. I believe Chris said that you can assume the appropriate number of command line arguments are passed to the ml program https secure.csse.uwa....


SVG not supported 2:08pm Sun 15th Sep, Joshua N.

ANONYMOUS wrote You can't pass "integers" to a function; the arguments are always doubles, so even if you pass 2, because the argument was defined to be a double, it will become 2.0. Every time you see a constant number, just put (double) in front of...


SVG not supported 10:45pm Sat 14th Sep, Joshua N.

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...


SVG not supported 10:43pm Sat 14th Sep, Joshua N.

ANONYMOUS wrote Hi, in both cases, the variables would be considered global since they are not located inside of a function.


SVG not supported 10:40pm Sat 14th Sep, Joshua N.

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 ...


SVG not supported 10:16pm Sat 14th Sep, Joshua N.

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.


SVG not supported 7:20am Sat 14th Sep, Joshua N.

https teaching.csse.uwa.edu.au units CITS2002 projects project1-syntax.php


SVG not supported 7:13am Sat 14th Sep, Joshua N.

No ml doesn't allow passing a function to a function. It is too complex for this project, and I don't believe it will be covered in the unit.


SVG not supported 7:10am Sat 14th Sep, Joshua N.

ANONYMOUS wrote Yes, the ml syntax allows it.


SVG not supported 7:09am Sat 14th Sep, Joshua N.

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.


SVG not supported 8:21am Fri 13th Sep, Joshua N.

ANONYMOUS wrote Best to ask Amitava.


SVG not supported 8:21am Fri 13th Sep, Joshua N.

ANONYMOUS wrote Yes


SVG not supported 8:21am Fri 13th Sep, Joshua N.

ANONYMOUS wrote No, because we are assuming expressions are valid and don't need to be checked.


SVG not supported 7:20am Fri 13th Sep, Joshua N.

ANONYMOUS wrote Best to ask Amitava.


SVG not supported 7:20am Fri 13th Sep, Joshua N.

ANONYMOUS wrote Best to ask Amitava.


SVG not supported 7:14am Fri 13th Sep, Joshua N.

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.


SVG not supported 10:43pm Thu 12th Sep, Joshua N.

ANONYMOUS wrote Tabs are a form of white space. More detail given here https secure.csse.uwa.edu.au run help2002?p np opt U351


SVG not supported 10:39pm Thu 12th Sep, Joshua N.

Best to ask Amitava for clarification.


SVG not supported 10:33pm Thu 12th Sep, Joshua N.

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...


SVG not supported 10:31pm Thu 12th Sep, Joshua N.

ANONYMOUS wrote It does apply to comments. He made the change to make sure the project isn't too hard. From Oxford English Dictionary "white space n. (a) Typography the blank areas of a page or other piece of printed matter, as margins, gutters betwe...


SVG not supported 9:24pm Thu 12th Sep, Joshua N.

ANONYMOUS wrote Best to ask Amitava.


SVG not supported 9:20pm Thu 12th Sep, Joshua N.

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...


SVG not supported 9:17pm Thu 12th Sep, Joshua N.

ANONYMOUS wrote If print appear outside a function in ml, then you put the print statements in main otherwise you'll get an error.


SVG not supported 9:16pm Thu 12th Sep, Joshua N.

I believe so, they would be two separate identifiers, but they would count towards "unique" identifiers since they have the same name.


SVG not supported 9:13pm Thu 12th Sep, Joshua N.

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.


SVG not supported 9:11pm Thu 12th Sep, Joshua N.

ANONYMOUS wrote Yes. Otherwise, there would be no way to differentiate between a normal variable and a command line argument.


SVG not supported 9:10pm Thu 12th Sep, Joshua N.

ANONYMOUS wrote Just add return 0.0 to the end of your functions if they don't have a return statement.


SVG not supported 9:09pm Thu 12th Sep, Joshua N.

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...


SVG not supported 9:04pm Thu 12th Sep, Joshua N.

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...


SVG not supported 8:59pm Thu 12th Sep, Joshua N.

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.


SVG not supported 8:50pm Wed 11th Sep, Joshua N.

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 ...


SVG not supported 8:46pm Wed 11th Sep, Joshua N.

The syntax of ml does seem to allow recursion, shouldn't be hard to implement (since you just copy the function call into C).


SVG not supported 8:45pm Wed 11th Sep, Joshua N.

ANONYMOUS wrote Best to ask Amitava.


SVG not supported 8:45pm Wed 11th Sep, Joshua N.

Best to ask Amitava.


SVG not supported 8:43pm Wed 11th Sep, Joshua N.

Note there are no empty lines in ml, "empty lines" start with a .


SVG not supported 8:42pm Wed 11th Sep, Joshua N.

ANONYMOUS wrote It would be illegal. The syntax of ml doesn't allow the printing of statements.


SVG not supported 8:40pm Wed 11th Sep, Joshua N.

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.


SVG not supported 8:38pm Wed 11th Sep, Joshua N.

I would say it works as it does in c, and would return 0, so the outer print would return 1.


SVG not supported 8:37pm Wed 11th Sep, Joshua N.

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.


SVG not supported 8:36pm Wed 11th Sep, Joshua N.

ANONYMOUS wrote Hi unfortunately because Chris is now on leave, I'm not sure if the website will be released.


SVG not supported 8:35pm Wed 11th Sep, Joshua N.

ANONYMOUS wrote If no clarification is given, better to be safe than sorry and check the number of parameters.


SVG not supported 8:35pm Wed 11th Sep, Joshua N.

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.


SVG not supported 8:30pm Wed 11th Sep, Joshua N.

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...


SVG not supported 8:27pm Wed 11th Sep, Joshua N.

ANONYMOUS wrote Yes, that seems correct.


SVG not supported 8:24pm Wed 11th Sep, Joshua N.

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.


SVG not supported 8:21pm Wed 11th Sep, Joshua N.

I believe it is fine to return zero if a function doesn't have a return value. Amitava please respond to the second question.


SVG not supported 8:19pm Wed 11th Sep, Joshua N.

ANONYMOUS wrote I think either is fine, but returning 0.0 is probably easier.


SVG not supported 8:19pm Wed 11th Sep, Joshua N.

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.


SVG not supported 8:17pm Wed 11th Sep, Joshua N.

ANONYMOUS wrote From your attachment your runml isn't correct. As many of the samples print, yet there is no output in your terminal.


SVG not supported 8:16pm Wed 11th Sep, Joshua N.

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...


SVG not supported 8:12pm Wed 11th Sep, Joshua N.

Hi Anon, Amitava said the deadline is next week Friday.


 UWA week 36 (2nd semester, mid-semester break) ↓
SVG not supported 5:27pm Fri 6th Sep, Joshua N.

You can do that if you want but I think the easiest way is to replace a with 0.0 if it doesn't match any identifier stored.


SVG not supported 5:25pm Fri 6th Sep, Joshua N.

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...


SVG not supported 4:56pm Fri 6th Sep, Joshua N.

Hi From my understanding, Chris said "appearing" so, you should only see at most 50 unique identifiers in a single ml file. So, in the case above b would count towards the total.


SVG not supported 4:56pm Fri 6th Sep, Joshua N.

ANONYMOUS wrote Hi From my understanding, Chris said "appearing" so, you should only see at most 50 unique identifiers in a single ml file. So, in the case above b would count towards the total.


SVG not supported 4:50pm Fri 6th Sep, Joshua N.

Actually sorry, I just realized made a mistake the datatype used should be doubles not floats because it has more precision (e.g. reduces rounding errors). So that way if you're multiplying dividing real numbers and showing 6 decimal plac...


SVG not supported 4:45pm Fri 6th Sep, Joshua N.

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.


SVG not supported 2:24pm Fri 6th Sep, Joshua N.

functions


SVG not supported 2:24pm Fri 6th Sep, Joshua N.

ANONYMOUS wrote Hi, There can be zero or more function in ml.


SVG not supported 9:22pm Thu 5th Sep, Joshua N.

ANONYMOUS wrote Hi question is answered here https secure.csse.uwa.edu.au run help2002?p np opt U145


SVG not supported 7:06pm Thu 5th Sep, Joshua N.

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...


SVG not supported 5:20pm Thu 5th Sep, Joshua N.

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...


SVG not supported 4:29pm Thu 5th Sep, Joshua N.

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...


SVG not supported 3:27pm Thu 5th Sep, Joshua N.

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...


SVG not supported 12:10pm Thu 5th Sep, Joshua N.

There are no integers in the ml program, all the constants are real numbers, as that is the only datatype supported by ml. So, all the constant integer values in the ml program are actually floats. e.g. "2" is technically "2.0". If there are rounding...


SVG not supported 7:59am Thu 5th Sep, Joshua N.

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...


SVG not supported 7:48am Thu 5th Sep, Joshua N.

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.


SVG not supported 10:08pm Wed 4th Sep, Joshua N.

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...


SVG not supported 10:04pm Wed 4th Sep, Joshua N.

For some reason it isn't appearing. The code is ". runml sample.ml"


SVG not supported 10:04pm Wed 4th Sep, Joshua N.

The content in the code block is . runml sample.ml


SVG not supported 10:03pm Wed 4th Sep, Joshua N.

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...


SVG not supported 7:36pm Wed 4th Sep, Joshua N.

Hi Both of those messages are fine, but in general the more descriptive the error message, the better.


SVG not supported 7:28pm Wed 4th Sep, Joshua N.

Hi Josiah, The ml language only supports real numbers. So, an ml file wouldn't contain a string literal.


SVG not supported 7:25pm Wed 4th Sep, Joshua N.

Hi Chenjun, When printed, numbers that are exact integers must be printed without any decimal places; other numbers must be printed with exactly 6 decimal places. Your program wouldn't need two datatypes, it would just need to change the format string ...


SVG not supported 7:21pm Wed 4th Sep, Joshua N.

Hello anon, Judging by the Syntax of ml, I would say parenthesis are required for function calls.


SVG not supported 7:14pm Wed 4th Sep, Joshua N.

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


SVG not supported 7:12pm Wed 4th Sep, Joshua N.

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 ...


SVG not supported 8:34am Wed 4th Sep, Joshua N.

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...


SVG not supported 8:10am Wed 4th Sep, Joshua N.

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.


SVG not supported 8:02am Wed 4th Sep, Joshua N.

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...


SVG not supported 9:41pm Mon 2nd Sep, Joshua N.

Hey Anon your question is answered here https secure.csse.uwa.edu.au run help2002?p np opt U172


SVG not supported 9:29pm Mon 2nd Sep, Joshua N.

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


SVG not supported 9:21pm Mon 2nd Sep, Joshua N.

Hello, I think your question is answered by this post https secure.csse.uwa.edu.au run help2002?p np opt U145


SVG not supported 9:19pm Mon 2nd Sep, Joshua N.

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


SVG not supported 1:58pm Mon 2nd Sep, Joshua N.

Hi, your question is answered here https secure.csse.uwa.edu.au run help2002?p np opt U145


SVG not supported 1:54pm Mon 2nd Sep, Joshua N.

Hi, your question is answered here https secure.csse.uwa.edu.au run help2002?p np opt U151


 UWA week 35 (2nd semester, week 6) ↓
SVG not supported 8:39pm Fri 30th Aug, Joshua N.

Hi, the way I remember it is that refers to a pointer if a datatype comes before it e.g. int . If there is no type beforehand, then is the dereference operation. e.g. int p , declares a pointer to an int. p refers to...


SVG not supported 9:17pm Tue 27th Aug, Joshua N.

This forum post may answer your question https secure.csse.uwa.edu.au run help2002?p np opt U143


SVG not supported 9:13pm Tue 27th Aug, Joshua N.

Hi unfortunately I am not Chris, but this forum post may answer your question post (https secure.csse.uwa.edu.au run help2002?p np opt U151)


 UWA week 33 (2nd semester, week 4) ↓
SVG not supported 5:10pm Wed 14th Aug, Joshua N.

ANONYMOUS wrote You're right. I think there is a typo in the answer. None of the options are correct. However, there is one option that is very close to the correct answer. Can you see which one it is?


SVG not supported 4:59pm Wed 14th Aug, Joshua N.

ANONYMOUS wrote One place to the left means index - 1 . e.g. If an integer is at index 3 it will be at index 2 after the code runs. Likewise, if an integer is at index 1, then after the code runs it will be at index 0. I hope that makes sense.


 UWA week 32 (2nd semester, week 3) ↓
SVG not supported 7:38am Fri 9th Aug, Joshua N.

Hi Guys, I am just reminding you to always keep up to date with the lectures, workshops and labs . If you don't you will struggle with this unit as there is a lot of content. Do not skip the lab exercises they are assessable and build up the fou...


 UWA week 30 (2nd semester, week 1) ↓
SVG not supported 9:17pm Thu 25th Jul, Joshua N.

Hey Jinyoung If I remember correctly floats are 4 bytes and doubles are 8 bytes (hence the name double) but Chris may need to clarify. An integer value must be at least 2 bytes (or 16 bits) but it is usually 4 bytes (32 bits). It's a bit confusing ...

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