Notices

  • Question 3(e)

    Posted by Jingling Xue Thursday 04 May 2023, 02:16:24 PM.

    Dear COMP3131/9102,

    As the given grammar is not LL(1), you are still required to construct the "LL(1) parsing table"
    except that it may contain multiple entries in some places.

  • The Exam Paper is now available

    Posted by Jingling Xue Thursday 04 May 2023, 12:55:58 PM.

    Dear COMP3131/9102 Student,

    The exam paper is now available.

    Good luck!

  • Our final exam

    Posted by Jingling Xue Wednesday 03 May 2023, 05:07:49 PM.

    Dear COMP3131/9102 Student,

    Please be reminded that our final exam will take place at the following time as already announced on our course page:

    About the Exam duration :

    • The exam will be open from 1pm AEST (Sydney Time) Thursday 4 May 2023 https://time.is/Sydney
    • The exam will close at 3:30pm AEST (Sydney Time) Thursday 4 May 2023
    • Anything submitted after 3:30pm AEST (Sydney Time) Thursday 4 May 2023 will be ignored

    Despite the fact that the exam will be conducted remotely without any invigilation, it will still be considered a closed-book assessment. Consequently, I won't be able to provide any assistance on how to solve specific problems during the exam, except in cases where you suspect that an exam question contains an error. If this happens, I can only confirm whether the question is correct, but I won't be able to offer any further assistance beyond that.

    There will be five questions as already revealed on our course page.


    You will be able to download the exam paper just before the exam starts.

    Good luck!



  • Exam

    Posted by Jingling Xue Tuesday 02 May 2023, 06:08:41 PM.

    Dear COMP3131/9102 Student,

    Please note that our final exam is done remotely and without invigilation. However, it still follows the closed-book format. If you take a look at Page 1 in each of the last two year's exam papers, Point 10 reads:

    10, No examination materials allowed.

  • Assignment 5 Marked

    Posted by Jingling Xue Saturday 22 April 2023, 03:29:55 PM, last modified Saturday 22 April 2023, 03:30:36 PM.

    Dear COMP3131/9102 Students,

    Assignment 5 has been marked. Please review your mark and inform me if there are any issues with your mark.

    As usual, you can find the feedback information, together with the test cases used, for marking this assignment.

  • Final Exam: 1pm -- 3:30pm 4 May (AEST)

    Posted by Jingling Xue Tuesday 18 April 2023, 08:33:53 AM.

    Dear COMP3131/9102 Students,

    The final exam is scheduled for May 4th from 1:00 PM to 3:30 PM AEST (Sydney Time). The exam paper can be downloaded from the course page by clicking the "Exam" button just before the exam starts, and it is important to review the instructions in advance, as they are already available. As with the programming assignments, you must submit your answers to all questions via give or WEBCMS. The exam will not be invigilated, so you must submit your own declaration via the course page before taking the exam.

  • Two Past Exam Papers

    Posted by Jingling Xue Sunday 16 April 2023, 07:54:41 PM.

    Dear COMP3131/9102 Students,

    You can download the two past papers from ~cs3131/Exams:

    21+22papers.zip

    cp ~cs3131/Exams/21+22papers.zip your-own-directory

    I will discuss this year's exam in the last lecture this week.



  • bubble.vc + bubble.j

    Posted by Jingling Xue Thursday 13 April 2023, 06:11:38 PM.

    Dear COMP3131/9102 Students,

    I have just included a new example, titled "bubble.vc", which performs bubble sorting. You can obtain both "bubble.vc" and "bubble.j" by downloading them from ~cs3131/VC/CodeGen, the directory where you download CodeGen.zip.

    You can create a lot of smaller test cases to ensure correctness for your implementation yourself.

  • gcd.j and max.j

    Posted by Jingling Xue Wednesday 12 April 2023, 07:39:21 PM, last modified Wednesday 12 April 2023, 07:53:43 PM.

    Dear COMP3131/9102 Students,

    Correction:

    The correct directory name should, of course, be ~cs3131/VC/CodeGen

    not ~/cs3131/VC/CodeGen. So, please download gcd.j and max.j from

    ~cs3131/VC/CodeGen as shown below.

    1. Login to a CSE login server.
    2. Copy ~cs3131/VC/CodeGen/gcd.j to your account.

    3. Copy ~cs3131/VC/CodeGen/max.j to your account.


  • The FAQs for Assignment 5

    Posted by Jingling Xue Monday 10 April 2023, 09:16:20 PM.

    Dear COMP3131/9102 Students,

    I have just added some FAQs at the beginning of the spec for Assignment 5,

  • Assignment 4 Marked

    Posted by Jingling Xue Thursday 06 April 2023, 11:34:08 PM.

    Dear COMP3131/9102 Students,

    Assignment 4 has been marked. Please check your marks and let me know if you have any issues with your marks.

  • CodeGen.zip

    Posted by Jingling Xue Thursday 06 April 2023, 11:00:45 PM.

    Dear COMP3131/9102 Students,

    If you have downloaded the supporting code for Assignment 5 previously, you may have a redundant vc.java file located under the CodeGen directory. This vc.java file is exactly the same as the one under the VC directory. Please delete the vc.java file from the CodeGen directory.

  • A Clarification for Assignment 5

    Posted by Jingling Xue Thursday 06 April 2023, 10:57:16 PM.

    Dear COMP3131/9102 Students,

    I understand that some of you are requesting "solution files" for Assignment 5. However, I would like to explain why such files do not exist and will not be provided.

    As you know, we are building a compiler for VC, and different compiler implementations will generate different code files, even for the same program. For example, LLVM and GCC will generate completely different code files for the same program. Therefore, there is no single "solution file" that can be provided for Assignment 5.

    To ensure that your compiler implementation is correct, you should use test cases with known outputs. For example, a small test case like:

    int main() { putInt(2); }

    will clearly show if your VC compiler is working correctly or not, since it should print the number 2. If your generated code does not produce this output, then there is an error in your implementation. You don't need to have any "solution file" to know this.

    If you are unsure of the output of a particular test case, you can always transform the corresponding VC program into an equivalent C program straightforwardly (since VC is nearly a subset of C) and compile it using a C compiler. This will give you the expected output for comparison with your VC compiler's output.

    Finally, please note that examining the Jasmin instructions generated by someone else's compiler is not helpful, as your implementation will not necessarily generate the same instructions.

    If you are uncertain about how to translate particular statements in VC into Jasmin assembly instructions, another option is to create a Java program that includes those statements, compile the Java program using javac, and then inspect the bytecode instructions generated with a disassembler, such as javap.

    I hope this clarifies why "solution files" cannot be provided for Assignment 5.

  • if.vc

    Posted by Jingling Xue Wednesday 05 April 2023, 03:54:54 PM, last modified Wednesday 05 April 2023, 07:55:47 PM.

    Dear COMP3131/9102 Students,

    In today's lecture, I used if.vc to explain the following restriction:

    JVM Spec:

    If an instruction can be executed along several different execution paths, the

    operand stack must have the same depth (2.6.2) prior to the execution of the

    instruction, regardless of the path taken.

    The program that I was supposed to use should be:

    int main () {

    if ( true )

    1 ;

    else

    ;

    return 1 ;

    }

    But I accidentally deleted the ";" in the else branch so the program became:

    int main () {

    if ( true )

    1 ;

    else


    return 1 ;

    }

    In this case, "return 1" becomes the single statement in the else branch. That is why the restriction above is not violated (since both branches don't merge at the end of the if statement).

    Now, if you translate the if statement in the first program, you will obtain:

    iconst_1

    ifeq L2

    iconst_1

    pop

    goto L3

    L2:

    L3:

    If you now delete "pop" and run the program (in a file named if.vc), then you will see the following error from the Java bytecode verifier:


  • Assignment 4: Spurious errorss

    Posted by Jingling Xue Monday 03 April 2023, 04:33:24 PM.

    Dear COMP3131/9102 Students,

    When marking Assignment 4, each test case contains only one single type error. You will not be penalised for generating spurious errors as long as the correct error message is reported.

    In Section 3 of the spec, Week 9 should read Week 7:

    To avoid printing a cascade of spurious error messages, you are advised to use the simple error recovery technique explained in Solution 2 to Question 2 in Week 9 Tutorial.

    You are encouraged to reduce the number of spurious errors reported but this is optional. So you don't have to adopt that solution if you don't want to.


  • Assignment 5 Released

    Posted by Jingling Xue Monday 03 April 2023, 04:26:51 PM.

    The spec for Assignment 5 has just been released. The supporting code, together with today's lecture, should suffice to help you implement a code generator for VC.

  • Week 5 Tutorial Recording

    Posted by Jingling Xue Tuesday 28 March 2023, 10:33:42 PM.

    Dear COMP3131/9102 Students,

    The tutor has made the Week 5 tutorial recording available.

  • The Bonus Assignment

    Posted by Jingling Xue Monday 27 March 2023, 11:37:33 AM.

    Dear COMP3131/9102 Students,


    For those who are interested in extending their VC compiler into an EVC compiler (where EVC is an extension of VC), the spec is now available.

  • Weeks 7 -- 8

    Posted by Jingling Xue Monday 27 March 2023, 11:35:11 AM.

    Dear COMP3131/9102 Students,

    Over the next two weeks, our primary focus will be on implementing the final module, which is code generation, for VC.

  • Error Messages in Assignment 4

    Posted by Jingling Xue Wednesday 22 March 2023, 10:45:45 PM.

    Dear COMP3131/9102 Students,

    When marking Assignment 4, we will utilise only small test cases. Typically, each test case will contain only one error, which will correspond to a unique error message. We will also carefully examine the error message(s) that are displayed in each test case. If a test case has multiple acceptable error messages, any of them will be deemed acceptable.

  • Assignment 3 Marked

    Posted by Jingling Xue Sunday 19 March 2023, 09:36:53 AM, last modified Sunday 19 March 2023, 09:55:24 AM.

    Dear COMP3131/9102 Students,

    Assignment 3 has been marked. Please check your marks. As before, you can find some feedback information from our course page.


    For those who wish to use a reference parser solution for Assignments 4 and 5, you can download it according to the instructions given in the spec of Assignment 4.

    We are moving closer to obtaining a complete compiler for VC. The type checker you are currently implementing in Assignment 4 is a visitor that traverses the AST of a program and performs type checks appropriately. When we return from the half-term break, we will see how to implement a code generation module in Assignment 5 as also a visitor.

  • Today's lecture on type checking

    Posted by Jingling Xue Wednesday 15 March 2023, 11:29:02 AM.

    In today's lecture (which is relatively short as the type checking itself is relatively straightforward), I will introduce how to write a type checker for Assignment 4.

    To help you understand the lecture better, the spec for Assignment 4 has just been released.

  • Infix2Postfix

    Posted by Jingling Xue Monday 13 March 2023, 05:43:20 PM.

    Dear COMP3131/9102 Students,

    During the second lecture of Week 3, I demonstrated the application of our infix2postfix grammar on a blackboard at Rex Vowels. Specifically, I illustrated how to convert an infix expression to its corresponding postfix expression. However, due to the dark lighting in the room, it was challenging for you to see the details of the work presented on the blackboard.

    I have just added a short video clip on our course page that explains the working out of the infix2postfix grammar:


    I hope this video clip will be helpful to everyone!

  • visitS() in VC/TreeDrawers/LayoutVisitor.java

    Posted by Jingling Xue Monday 06 March 2023, 05:14:36 PM.

    Dear COMP3131/9102 Students,

    If you haven't downloaded any supporting code yet for Assignment 3, please ignore this message.

    (1) Delete S.java under VC/ASTs, and
    (2) Delete visitS() in VC/TreeDrawers/LayoutVisitor.java

    267 // for lecture 7 only

    268 //public Object visitS(S ast, Object obj) {

    269 // return layoutUnary("S", ast.E);

    270 // }


    since S.java was created by me to introduce an attribute grammar this week.

  • S.java

    Posted by Jingling Xue Monday 06 March 2023, 09:41:10 AM.

    Dear COMP3131/9102 Students,

    If you haven't downloaded any supporting code for Assignment 3, just ignore this message.


    For Assignment 3, if you have downloaded ASTs.java earlier, it came with a file named S.java, which is something I created for teaching purposes (to be used this week when introducing attribute grammars).

    Please just delete it.


  • Assignment 2 Marked

    Posted by Jingling Xue Monday 06 March 2023, 08:35:56 AM, last modified Monday 06 March 2023, 08:36:36 AM.

    Dear COMP3131/9102 Students,


    Assignment 2 has been marked. You can now move on to extend your recogniser to obtain a parser for Assignment 3.

    You can find some feedback information for Assignment 2 online on the course page.

  • Reference Scanner Solution

    Posted by Jingling Xue Saturday 04 March 2023, 07:28:09 AM.

    Dear COMP3131/9102 Students,

    If you don't use the reference scanner solution, please ignore this message.

    If you use the reference scanner solution, it is necessary to prevent your existing scanner files (such as Scanner.java) from being recompiled. Failure to do so can result in "strange" error messages due to version issues, and the reference solution being overwritten. The easiest solution to avoid this problem is to run the "touch" command on all classes provided in the reference solution, preventing the Java compiler from recompiling your Java files.

    This is what you usually do when you reuse someone else's class files.

  • VC/ASTs.zip

    Posted by Jingling Xue Friday 03 March 2023, 05:40:44 PM.

    Dear COMP3131/9102 Students,

    If you have already downloaded ASTs.zip, just delete S.java since it is used for teaching purposes.

    If you haven't, just ignore this message.

  • Assignment 3

    Posted by Jingling Xue Friday 03 March 2023, 03:57:53 PM.

    The spec for Assignment 3 is now available. I have released this two days before the deadline of Assignment 2 for the following reasons:
    (1) Assignments 2 and 3 are one assignment. Those who have finished Assignment 2 can now start working on Assignment 3.
    (2) You can understand the last lecture better by looking at the supporting packages provided for Assignment 3.

  • Tomorrow's lecture: turning your recogniser into a parser

    Posted by Jingling Xue Tuesday 28 February 2023, 06:32:41 PM, last modified Tuesday 28 February 2023, 06:33:14 PM.

    In tomorrow's lecture, I will discuss how to extend your recogniser into a parser that not only performs syntactical analysis but also creates an AST (abstract syntax tree) representation for the program being parser.

    There is not much theory behind this process. All you need to do is to make use of a set of AST classes provided to create different types of tree notes and then link these tree nodes together to form a tree. You will therefore have an opportunity to write code to build linked lists of various kinds recursively.

    You will understand this lecture better if you have already started working on developing your recogniser.

  • Assignment 1 Marked

    Posted by Jingling Xue Friday 24 February 2023, 08:47:44 AM.

    Dear COMP3131/9102 Students,

    Assignment 1 has been marked. Please check your marks and let me know if there are any problems with your marks.

    Please also go to our course page to see some feedback and marking statistics.

  • Week 3 Monday Lecture

    Posted by Jingling Xue Thursday 23 February 2023, 07:29:48 PM.

    Dear COMP3131/9102 Students,


    In the coming Monday lecture, we will revisit First and Follow sets as well as top-down parsing.

    By the way, the lecture recording for this Wed was cut off at the end, but nothing was missing really.
    I will talk about Assignment 2 again in more detail.

  • Assignment 2

    Posted by Jingling Xue Wednesday 22 February 2023, 04:35:15 PM.

    Dear COMP3131/9102 Students,

    The spec for Assignment 2 has just been released.

  • Today's lecture

    Posted by Jingling Xue Wednesday 22 February 2023, 04:20:56 PM.

    Dear COMP3131/9102 Students,

    I have recently had some issues with my throat. I apologise if this has affected the delivery of today's lecture (and its recording).

  • Escape Characters

    Posted by Jingling Xue Sunday 19 February 2023, 11:35:45 AM.

    Dear COMP3131/9102 Students,

    Escape characters can only appear inside a string. Once recognised, they are handled in exactly the same way as non-escape characters.

    For for FF, CR and LR that may appear outside strings, you can safely assume that in all test cases used for marking this assignment, every line is always terminated by `\n'.

  • Late Penalty

    Posted by Jingling Xue Friday 17 February 2023, 11:36:33 AM.

    Dear COMP3131/9102 Students,

    As mentioned in the course outline (and also the first lecture), this course adopts a non-standard penalty rate (approved by the school). Here is a new paragraph I have just added to the spec of Assignment 1 under Section 9 "Late Penalities":

    Given the nature of our five programming assignments (as mentioned in the course line and also our first lecture), this course adopts a non-standard penalty rate (approved by the school). Given their tight deadlines, all programming assignments will usually be marked 1 or 2 days after their due dates in order to provide some feedback to you quickly to help you start working on the following assignment almost immediately.

    Please note that the penalty is applied to the total rather than the actual score awarded.

    For Assignment 1, the late penalty per day has been reduced from 3 marks to 2.4 marks.

  • Assignment 1

    Posted by Jingling Xue Wednesday 15 February 2023, 12:00:14 PM.

    Dear COMP3131/9102 Student,

    When working on this assignment, please read the VC spec quickly to understand how identifiers are defined in VC (same as in C/C++/Java) and how floating-point numbers are defined (same as in C/C++/Java).

    Please also read its FAQs first. Whenever the spec for an assignment is released, please read its associated FAQs before you start working on that assignment.

  • Lecture Recordings

    Posted by Jingling Xue Monday 13 February 2023, 08:49:51 PM.

    Dear COMP3131/9102 Students,

    Somehow, they didn't seem to have set up the lecture recordings for OMB 149 correctly. I have just added a link to the last year's recording made on my laptop for the first lecture. Do remember that this was for last year. Anything I talked about related to Teams will no longer be relevant. However, everything else (including the assignment details) remains the same.

    You can go to Lectures and then find the link for last year's lecture recoding for Week 1 (Monday).

    Hopefully, the lecture recording issue for OMB 149 can be fixed soon.

  • The spec for Assignment 1

    Posted by Jingling Xue Monday 13 February 2023, 07:18:01 PM.

    Dear COMP3131/9102 Student,

    The spec for Assignment 1 is already available online.

  • Week 2: F2F Tutorials Will be Done Online

    Posted by Jingling Xue Monday 13 February 2023, 06:18:49 PM.

    Dear COMP3131/9102 Students,

    This message is for those who have enrolled on the following three F2F tutorial classes:

    T17A Tue 17:00 - 18:00

    T18A Tue 18:00 - 19:00

    T19A Tue 19:00 - 20:00

    Due to some personal reasons, these tutorials will be done online by the tutor in Week 2. However, starting from Week 3, these tutorials will be done F2F as scheduled.

    We apologise if this may cause any inconvenience to you.

  • Welcome to COMP3131/9102

    Posted by Jingling Xue Monday 06 February 2023, 09:24:22 AM.

    Dear COMP3131/9102 Student,

    Welcome to COMP3131/9102!

    Please take a look at the course online to see how you can get the best out of this course.


Back to top

COMP3131/COMP9102 23T1 (Programming Languages and Compilers) is powered by WebCMS3
CRICOS Provider No. 00098G