CSC254 Discussion Page

No public posts in this group. You must login and become a member in order to post messages, and view any private posts.

Q0: What's the meaning of life?
A0: 42.

Q1: How to use hg to submit my stuffs into the repository?
A1: The instructions of creating a local repository and downloading from the global repository are on Class repository setup. To do a submission, you need four steps: pull and update, add, commit, and push. Following is an example:

  • hg pull;hg update (make sure you are doing a submission based on the latest revision of the global repository)
  • hg add THE_FILE_OR_DIRECTORY_TO_BE_ADDED (this step is unnecessary if the modified file or directory is already in the repository)
  • hg commit -m "SOME_COMMENTS_FOR_THIS_SUBMISSION" (only check into your local repository)
  • hg push (check into the global repository from which TA can get your code and report)

You may search online to find more advanced features of hg mercurial. There is an on-line book Mercurial: The Definitive Guide by Bryan O'Sullivan.

Q2: How do I deal with main(), printf(), and scanf()?
A2: Do NOT put the class number behind these functions. Leave them, otherwise a processed program cannot be compiled successfully.

Q3: Do I need to worry about non-local information in my tokenizer?
A3: No, you don't need to. The basic task of a typical tokenizer/scanner is to check a literal string (divided by white spaces) and return the right token to a parser. And it repeats the basic task for all literal strings in the input source file. This means tokenizer only knows very local information---the current literal string. Some test cases turned in you are sort of "evil", which requires non-local information, such as "int 8", "int main[1]", and "int break". It is NOT mandatory to deal with these cases correctly.

Q4: How do I use irb on csug machines?
A4: Irb will be installed on the undergrad network this Friday (10/01/10). Then you may try features of ruby in a very quick and interactive way.

Q5: How to break down a for loop using goto statements?
A5: See the following pseudo-code. (Note: It is while loop not for loop in the grammar specifications.)

        for (i=1;i<100;i++) {

    ***AFTER CODE GEN***
        if i>=100 goto AFTERLOOP_LABEL;
        goto LOOPENTRY_LABEL;

Syndicate content