Code Monkey home page Code Monkey logo

cs420's People

Contributors

anhaechan avatar cmpark0126 avatar jeehoonkang avatar jirheee avatar kaist-cp-infra avatar minseongg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cs420's Issues

A timeout from fuzz.py

In KECC, if one has not built the binary in the release mode before running the fuzzer, the fuzzer results in a timeout since it tries to build the binary in 10 seconds. I believe that to solve the issue, it would be better to add

subprocess.Popen(["cargo", "build", "--release"]).communicate()

at the 105th line before

for i in iterator:

in tests/fuzz.py or to revise the file similarly.

[Session 2] March, 19th

Please do the following for the first online session.

The fuzzer fails after the latest change

Hi. I am using macOS.

The fuzzer generates code that cannot be parsed. The tests/test_polished.c file contains the following:

int __inline_signbitl(long double __x) {

    } __u;
    __u.__ld = __x;
    return (int)(__u.__p.__sexp >> 15);
}

It was originally the same as the following:

__header_always_inline int __inline_signbitl(long double __x) {
    union {
        long double __ld;
        struct{ unsigned long long __m; unsigned short __sexp; } __p;
    } __u;
    __u.__ld = __x;
    return (int)(__u.__p.__sexp >> 15);
}

However, it seems that the following replacement rules in fuzz.py cannot handle nested struct definitions properly.

    "union": "struct",
    "  struct[^{]*[^}]*}[^;]*;": "",

Thank you.

[Question] Does JavaScript really use dynamic scoping?

In lecture 3(intermediate representation), professor mentioned JavaScript as one particular example of languages that use dynamic scoping. However, as far as I know, JavaScript uses lexical scoping like C, C++. Here is concrete example.

function foo() {
    console.log(a);
}

function bar() {
    var a = "local";
    foo();
}

var a = "global";
foo(); // global
bar(); // global

The cmp.c test case seems not to be able to be passed

Hi.

In the latest change, cmp.c has been added to the test cases. It requires a comparison between signed integers. However, the current version of the IR interpreter does not support comparisons between signed integers. Therefore, it seems that cmp.c cannot be passed even though one implements IRgen correctly. I believe that it is not a big problem since there are some TODO parts in the interpreter and they will be implemented soon. However, I think it would be nice to share the issue so that one can avoid spending one's time to fix correct code.

If I am missing something, please let me know.

Thank you.

[Homework 2] IRgen (due: 8th of July)

  • Refer to the skeleton code: https://github.com/kaist-cp/kecc-public Please be noted that the skeleton code will likely change quite frequently. Please merge the upstream changes to your development.

  • For homework 2, implement the IR generator: https://github.com/kaist-cp/kecc-public/blob/master/src/irgen/mod.rs#L24 Given a C AST, you should generate an equivalent IR.

  • The forthcoming lecture videos will explain how to do this work.

  • While it is due on 8th of July, I strongly recommend you to start as early as possible. We will enjoy other pieces of homework at the later stage of the semester.

  • The grading scheme is simple: you either implement a complete IRgen or not. You can submit your code multiple times. You can grade your submission yourself by running, e.g., cargo test --release test_examples_irgen and python3 tests/fuzz.py -i -n30.

  • If fuzzer finds a buggy input for your IRgen, you can reduce it as follows: python3 tests/fuzz.py -i --reduce; cat tests/test_reduced.c. We strongly recommend you to do this homework in a TDD way: fuzz, reduce, debug, repeat.

  • Submit your irgen/mod.rs to https://gg.kaist.ac.kr/assignment/8/ (big) and https://gg.kaist.ac.kr/assignment/9 (small).

[HW 1] Wrong assert_supported implementation?

Hello,
I'm not sure about the purpose of assert_supported, but I guessed that it limits the range of statements and expressions we are going to support in our class.

Currently, Statement::Labeled(labelstatment) is classified to panic, (parse.py#L305)
while label statements are used in switch statements.
There were many Label assert_supported implementations in parse.py,
so I guess it was a mistake.

Thank you.

Rust: cargo build does not work

My student id is 20140600.
I connected to my server and tried Rust: cargo build with ctrl+shift+b, but it failed.
The output says

오류: cargo 작업 검색에서는 다음 구성에 대한 작업을 제공하지 않습니다:
{
"type": "cargo",
"subcommand": "build",
"problemMatcher": [
"$rustc"
],
"group": "build"
}
이 작업이 무시됩니다.

And the terminal says this.

Executing task: cargo build <

error: could not find Cargo.toml in /home/s20140600 or any parent directory
터미널 프로세스가 종료 코드 101(으)로 종료되었습니다.

터미널이 작업에서 다시 사용됩니다. 닫으려면 아무 키나 누르세요.

How could I build in another directory?

Also, your youtube video https://www.youtube.com/watch?v=TTVuUIhdn_g&list=PL5aMzERQ_OZ8RWqn-XiZLXm1IJuaQbXp0&index=3 does not show your activity properly from 4:30, which makes it hard to understand.

[HW2] Will interpreter of more unaryoperators be added?

There is only some unary operator interpretation implemented in KECC. (+, -, ~)
commonly for statement uses post or pre-incremental operator (i.e. i++),
but it is not implemented in KECC.
Should I wait for the implementation of interpreter or
implement unary-operation with several save and load instructions?

+ What is the intended size of long double in KECC?

I have no idea why test version is different with running version

When I run my homework 1 with "cargo run -- -p examples/fibonacci.c" command, it works well. However, when I run "cargo test test_examples_write_c" command, it stuck because of parse error at examples/fibonacci.c
I tried "cargo build" and "cargo build --release"
Why test of my implementation works differently for same file?
I'm using Window but remoteing cs420 server by VS Code.

Some broad questions involving homework

My favorite thing about this course is that the assignments are iterative processes that are due the end of the semester.
However, because of this, and because we are having classes in a way that can feel sort of disconnected, it is difficult to check if I'm following the class in a good pace.

In addition, for some recent lectures that explain our homework(e.g. the two recent IRGen videos), it is somewhat confusing whether I should start the homework after all the IRGen videos are over, or I should start the homework beforehand so that I can understand the videos more easily, or I should try to follow along as each video is released.

So how many homework should we expect, and when is the best(expected) time to start each homework?

Installing packages in VM

Hello,
I was trying to install YCM for Rust code completion in Vim, and as it turns out I cannot use sudo apt because I don't have root permission.
I completely understand that you cannot give root permission to students, but I cannot find another way because I have little knowledge of Ubuntu package managing. Is there a workaround that doesn't require root permission?
Thank you.

test failures?

I downloaded and ran the 'cargo test' command on kecc-public, and got the following error.

running 2 tests
test test_examples_irgen ... FAILED
test test_examples_write_c ... FAILED

failures:

---- test_examples_irgen stdout ----
[testing "examples/alignof.c"]
thread 'test_examples_irgen' panicked at 'parse failed "examples/alignof.c": ParseError(PreprocessorError(Os { code: 2, kind: NotFound, message: "지정된 파일을 찾을 수 없습니다." }))', tests\test_examples.rs:22:25
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

---- test_examples_write_c stdout ----
[testing "examples/alignof.c"]
thread 'test_examples_write_c' panicked at 'parse failed "examples/alignof.c": ParseError(PreprocessorError(Os { code: 2, kind: NotFound, message: "지정된 파일을 찾을 수 없습니다." }))', tests\test_examples.rs:22:25

am i missing something here?

cargo doc --open doesn't work

Hello.

I'm trying to start HW1.

But when I run the command 'cargo doc --open', below error occurs.

warning: Couldn't open docs: command 'xdg-open (internal)' did not execute successfully; exit code: 3
command stderr:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Couldn't find a suitable web browser!
Set the BROWSER environment variable to your desired browser.
Warning: program returned non-zero exit code #1
sh: 881: www-browser: not found
sh: 881: links2: not found
sh: 881: elinks: not found
sh: 881: links: not found
sh: 881: lynx: not found
sh: 881: w3m: not found
xdg-open: no method available for opening '/home/s20160108/Works/kecc-public/target/doc/kecc/index.html'

Can you help me with this problem?

Thank you.

Will you upload updated /src/irgen/mod.rs?

In IRgen video, /src/irgen/mod.rs code (in video) is quite different from what was uploaded 13 days ago.

Homework 2 is implementing IRGen in this file, and I wonder whether updated src/irgen/mod.rs will be uploaded.

It's because there are some boilerplate codes such as impl Translate<Parse> for Irgen. I wonder whether I can directly use those boilerplate codes.

Moreover, impl fmt::Display for IrgenError is different in uploaded file and file in video. In uploaded file, it uses write!(f, "IrgenError"), but there is write!(f, "error: {}\r\n\r\ncode: {}", self.message, self.code) in video.

If updated file will be uploaded, it will be helpful to get it before we do too much homework2!
Thanks in advance!

Issue with SSH

I'm having trouble when connecting to SSH-server. I think it's issue of my SSH-key password. Should I resubmit key and try again or do you have other instruction?

[Session 3] March, 24th

Please do the following for the first online session.

Please ask questions even if you don't know exactly how to ask

In today's Q&A session, a student said it's difficult to even ask a question because he don't know where to start the homework. Then please ask so. The following discussions will clarify your question and lead us to an answer.

For example, the discussion here started from quite a broad question, which can be summarized as "where can I start from for the homework 1?" The following discussions reveal some tips for doing homework 1, which I hope everyone to look at. I hope more discussions to happen for other topics and homework as well.

Question about: impl TryFrom<Dtype> for Declaration

Hello!
Im trying to understand the try_from function defined for the Declaration (i.e. row 34 in src/ir//mod.rs).

In the documentation comments above the function definition, it says that it can return a Declaration::Variable with "Some(...)" as initializer. But in the code, it seems as it sets the initializer to "None" for all cases.
Is there something deeper happening in the code that will make the initializer of the Declaration::Variable into a "Some(...)-instance" or will it always be returned with None as initializer?

Thankful for any input!

Best regards
Jesper

[Session 6] April, 2nd

Please do the following for the online session.

  • Watch the "IRgen (Overview)" video: https://www.youtube.com/watch?v=YPtnXlKDSYo

    • It's long and dense. More detailed guide to IRgen will be provided in the forthcoming sessions.
      Also, the next Tuesday's lecture will be shorter than usual.
    • Please feel free to ask questions if you don't understand some aspects of the lecture video.
  • Solve the attendance quiz by 23:59PM, 2nd of April: https://gg.kaist.ac.kr/quiz/6/

  • The homework 1 (#8) skeleton is changed. Please merge the upstream changes.

  • The homework 2 (#35) is issued. Read the instructions in the homework issue.

  • Read the "Rust book" from Chapter 17 to 21: https://doc.rust-lang.org/book/

    • It's over! Please feel free to ask questions if you don't understand some aspects of the Rust programming language.

What does the --release option do?

AFAIK building with the --release option causes the use of different configurations.
So would 'cargo build' and 'cargo build --release' create two different files?
What does the 'build result' file look like and where can I see it?
Why would one need to use the --release option while doing the homeworks?

[HW2] how can we get the pointer of other function's local variables?

void f1 (int * a) {
  a[1] = 1;
}
void main () {
  int a[5];
  f1(a);
}

In this example, main will allocate 5 int variables for its own stack frame, and it will pass the pointer to f1.
Then, f1 will allocate a local pointer variable a in its own stack frame, so we can get the value a[0], but I'm not sure how to get other allocated values (a[1] ... a[4]) via pointer operation. It seems typecast is also not an answer because there is no interpreter code to typecast integer to pointer.
Also, we can use only allocation ids (aid) but not bid (the one used for memory, not block id) because there are 3 registerId types : local, args, and temp.

Any hints to get the pointer of other function's local variables?

[Homework 1] C AST printer (due: 8th of July)

  • Refer to the skeleton code: https://github.com/kaist-cp/kecc-public Please be noted that the skeleton code is not just for homework 1 but for the entire KECC. It will likely change quite frequently. Please merge the upstream changes to your development.

  • Here's a guide video.

  • For homework 1, implement a C AST (abstract syntax tree) printer: https://github.com/kaist-cp/kecc-public/blob/master/src/c/write_c.rs#L45 Given a C AST, you should print a valid C code. We will not deal with the "full" C but focus on a subset of C that is defined in https://github.com/kaist-cp/kecc-public/blob/master/src/c/parse.rs . The purpose of this homework is getting acquainted with the C language we will deal with, and in general, the skeleton code written in Rust.

  • I strongly recommend you to run cargo doc --open and browse the repository, and specifically, the definition of C AST (the lang_c library).

  • While it is due on 8th of July, I strongly recommend you to start as early as possible. We will enjoy other pieces of homework at the later stage of the semester.

  • The grading scheme is simple: you either implement a complete C AST printer or not. You can submit your code multiple times. You can grade your submission yourself by running, e.g., cargo test --release test_examples_write_c and python3 tests/fuzz.py -p -n30.

  • Submit your write_c.rs to https://gg.kaist.ac.kr/assignment/7/ .

Error for ssh connection with vscode, and its solution

I'm using Window 10, Vscode 1.43.1

For me, I have successful ssh connection with cmd, by instruction of README.
However, with vscode, it doesn't work with instuction of README and provided youtube lecture.
(Retry connection so many times when I connect to server with vscode.)

I suffered from this issue for lots of time and I want to share for everyone who has same issues.

The solution is below.

This is an open issue in VSCode Remote-SSH version 0.50.0. See Issue #2527.

The way I resolved it was to downgrade to version 0.49.0.

In VSCode, Ctrl+Shift+X to open extensions
Click the Manage icon next to the Remote - SSH extension
Click Install Another Version... from the options
Select the version to install (0.49.0)
I also recommend disabling the Extensions Auto Update in settings so this type of thing doesn't happen in the future with this or any other extensions.

(Solution From https://stackoverflow.com/questions/60642938/vscode-v1-43-remote-ssh-cannot-connect-v1-42-works)

[Session 8] April, 9th

Please do the following for the online session.

Question about SSH setup for VSCode

In the first online session, you showed us how to use VSCode using an existing network configuration.
Could you give us some instructions or references to how to create this configuration in the first place, especially using the Linux servers that has been(will be) assigned to each of us using our submitted SSH keys?
Thank you in advance.

Could not establish connection to 'cs420'

I connected to the server yesterday, but I cannot connect to the server 'cs420' with error message as above. I tried all the solutions already uploaded, but I still cannot solve this problem. May I ask some help?

Thank you.

[Hw1 Question] How do we find out what nodes are in the AST?

So for homework 1, we are supposed to implement the function write_line for TranslationUnit, which is the root node of a AST by recursively implementing write_line(or write_string) for each child case of the TranslationUnit.
Is there a way to know what kind of nodes exist and have what nodes have what children? Or is this considered basic background knowledge or is easily found? I've searched the codebase with cargo doc --open but I only see the datatype declarations. I've also googled for clang translationUnit, but I only see Node and Tree, which don't really solve my problem?
This is probably a dumb question, but I am stuck from the beginning, might as well ask.

Suggestion to turn on Do Not Disturb when recording video

I've been replaying the homework 1 video and every single time I heard a slack notification sound I couldn't resist but to check on my slack, when and notification was in fact coming from the video.

I suppose this harms the focus of the viewers in video lecture. Could you consider turning on Do Not Disturb when recording future videos?

Incorrect Equivalence Checking for ASTs

The fuzzer said that my pretty printer was wrong, but I could not find any problem. After inspecting the ast_equiv.rs file, I found that there was a small bug.

@@ -102,6 +102,7 @@ impl IsEquiv for Declarator {
 impl IsEquiv for DeclaratorKind {
     fn is_equiv(&self, other: &Self) -> bool {
         match (self, other) {
+            (Self::Abstract, Self::Abstract) => true,
             (Self::Identifier(identifier), Self::Identifier(other_identifier)) => {
                 identifier.node.name == other_identifier.node.name
             }

After fixing the bug, it seems that the fuzzer correctly compares ASTs.

[Session 5] March, 31th (REALTIME Q&A)

  • On 31th of March, we will have a realtime Q&A session. Please join in Google Hangout Meet (https://meet.google.com/bms-btcx-ohp) at 10:30am.

  • It's not mandatory: I'll not ask attendance quiz.

  • If you have questions, please ask them in the issue tracker first, and label them as question. You can write down questions in Korean. For management purposes, I may not be able to answer pop questions during the realtime Q&A session.

[Session 4] March, 26th

Please do the following for the first online session.

AssertSupported trait and Fuzzer do not eliminate extension property

As @Medowhill already pointed out in his suggestion, __asm should be removed in source code. But current latest commit does not handle this. When I face this issue, I also notice that in AssertSupported implementation for Declarator, they just call self.extension.is_empty() but it is just boolean value, so it does not raise panic even it has extensions. So, I suggest to patch AssertSupported for Declarator and ParameterDeclaration, and patch fuzzer to remove __asm extension.

diff --git a/src/c/parse.rs b/src/c/parse.rs
index be36ba6..19b6de3 100644
--- a/src/c/parse.rs
+++ b/src/c/parse.rs
@@ -217,7 +217,7 @@ impl AssertSupported for Declarator {
     fn assert_supported(&self) {
         self.kind.assert_supported();
         self.derived.assert_supported();
-        self.extensions.is_empty();
+        assert_eq!(true, self.extensions.is_empty());
     }
 }

@@ -282,7 +282,7 @@ impl AssertSupported for ParameterDeclaration {
     fn assert_supported(&self) {
         self.specifiers.assert_supported();
         self.declarator.assert_supported();
-        self.extensions.is_empty();
+        assert_eq!(true, self.extensions.is_empty());
     }
 }

diff --git a/tests/fuzz.py b/tests/fuzz.py
index f7ebcb2..1db1de3 100644
--- a/tests/fuzz.py
+++ b/tests/fuzz.py
@@ -36,6 +36,8 @@ REPLACE_DICT = {
     "\"g_\w*\", ": "",              # transparent_crc에서 프린트 목적으로 받은 StringLiteral 삭제
     "char\* vname, ": "",           # transparent_crc에서 사용하지 않는 파라미터 삭제
     r"[^\n]*_IO_2_1_[^;]*;": "",    # extern을 지우면서 생긴 size를 알 수 없는 struct 삭제
+    r"__asm\s*\([^\)]*\)": "",      # asm extension in mac
+    r"__asm__\s*\([^\)]*\)": "",    # asm extension in linux
 }
 CSMITH_DIR = "csmith-2.3.0"

Originally posted by @j31d0 in #27 (comment)

The fuzzer is not working

After the update, the fuzzer shows the following:

Traceback (most recent call last):
  File "tests/fuzz.py", line 252, in <module>
    fuzz(tests_dir, fuzz_arg, args.num)
  File "tests/fuzz.py", line 223, in fuzz
    raise Exception("Test `{}` failed with exit code {}.".format(" ".join(args), proc.returncode))
Exception: Test `cargo run --release --bin fuzz -- -p /Users/medowhill/workspace/rust/kecc-public/tests/test_polished.c` failed with exit code 101.

When I run cargo run --release --bin fuzz -- -p /Users/medowhill/workspace/rust/kecc-public/tests/test_polished.c, I can see the parser has panicked because of the unsupported features of KECC.

I tried again after revising fuzz.py as below, but string literals in generated code are problematic. I tried removing string literals, but it makes parsing fails.

-    "__restrict": "",
+    "restrict": "",
+    "_Nullable": "",
+    "inline ": "",
+    r"0x[0-9a-fA-F]*\.[0-9a-fA-F]*p\-?[0-9]*f?": "1.0f",
+    r"0x[0-9a-fA-F]+p\-?[0-9]*f?": "1.0f",
+    r"__asm\(.*\)": "",
     "long __undefined;": "",
     "return 0;": "return crc32_context % 128;",
-    r"__attribute__ \(\(.*\)\)": "",
+    r"__attribute__ ?\(\(.*\)\)": "",

As I am using macOS, I have not tried in Linux. Can it be a macOS-specific problem of csmith?

Debugging Error in [Setting up Visual Studio Code] lecture

20140629 함창수 입니다.

[KAIST CS420, 2020 Spring] Setting up Visual Studio Code 강의를 따라하는 과정에서 질문이 있습니다.
atomic.rs 파일에서 building하는 것까진 되었는데, debbuging부터 에러가 발생합니다.

(1) 우선 강의(4:14)에서 "by pushing this button using LDB..."라고 하셨는데 영상에선 어떤 버튼을 누르시는 것인지 보이지가 않아 어떤 버튼인지 궁금합니다.

(2) [Run] > [Start Debugging]을 해보니 아래와 같은 팝업이 뜹니다. (참고로 관련이 있는지는 모르겠으나 교수님과 launch.json 파일 내용도 크게 다릅니다)
스크린샷 2020-03-20 오전 12 01 19

(3) 디버깅조차 안 되긴 하지만, breakpoint를 어디에 하라는 것인지 표시가 안 보여서 이것도 궁금합니다.

Debug command displays error

I have setup the rust environment and builded successfully. However, upon selecting 'Run > Start Debugging', I get the following error.
Internal debugger error: unable to find executable for '/home/s20180595/Works/crossbeam/'
Then it says 'Open launch.json', which I think means that I need to add a configuration for debugging. However, none of the options generated from the 'Add Configuration' button seems to be working.
This seems to be related to a dialog that I accidentally dismissed, that said something about auto-creating a configuration when I was running the build command (how stupid of me to press cancel..😣)
Any ideas on how to solve this problem?

How did the realtime qna session went?

I wanted to participate in the Hangout meeting today at 10:30, but I failed to do so.

I clicked "참여 요청" several times, but there was no relply.

So I am curious how the qna session went, to get ready for further qna sessions in this course. Was it a group meeting, or a 1:1 qna session?

Also, I had no question, but I just wanted to listen what other students were asking. So, was it possible to stay in the meeting without any question during the realtime qna session?

Thanks in advance :)

  • I cannot figure out a way to add a label to this issue so I left it unlabelled.

ssh remote connection problem.

Hello.
When I try to connect ssh connection, it fails with error message "프로세스에서 없는 파이프에 쓰려고 합니다"
I 'was' able to connect server until several days ago, but I failed today.
I tried to find the reason, and internet said the cache is problem, however in my computer, I cannot find same folder. Are there any way to solve this problem?

The folder which internet said was 'VSCODE' and 'VSCODE-INSIDERS'

Thank you.

Best regard,
Chang Gunho

Hexademical?

There's an typo in kecc 'Hexademical' instead 'Hexadecimal'.
However, gg.kaist.ac.kr has right one. I think I should update my kecc, but how?
Can anybody help me updating my kecc?

Permission Denied Error when I install CodeLLDB Extension in VSCode

When I install CodeLLDB Extenseion in VSCode, Permission Denied Error occured with below OUTPUT

Installing platform package from https://github.com/vadimcn/vscode-lldb/releases/download/v1.5.0/codelldb-x86_64-linux.vsix
Error: Error: EACCES: permission denied, open '/tmp/vscode-lldb-full.vsix'

image

May I ask how to solve it?

An unexpected behavior of creduce

Hi.

When I execute python3 tests/fuzz.py --reduce --irgen, after the reduce, the content of the tests/test_reduce.c file is the same as the following:

void main() {}

For me, it seems a bit weird since tests/test_polished.c contains the following:

int main (void)
{
...

Even though the original source code has the main function with the return type int, the reducer produces the main function with the return type void.

I believe that the behavior can be problematic. My IRgen generates an IR function that returns the value Unit if its return type is void. For this reason, void main() {} cannot be passed since its expected result is 0, which is the exit code. It implies that the reducer always results in the same code unless I change IRgen to return 0 from the main function with the return type void.

Do we have to consider the main function with the return type void? It seems main returning void is not a part of the standard semantics.

The function called at program startup is named main. The implementation declares no prototype for this function. It shall be defined with a return type of int and with no parameters:
int main(void) { /* ... */ }
or with two parameters (referred to here as argc and argv, though any names may be
used, as they are local to the function in which they are declared):
int main(int argc, char *argv[]) { /* ... */ } or equivalent; or in some other implementation-defined manner.

It looks like that whether one allows main to return void depends on implementation.

Otherwise, could you revise the reducer not to make the main function return void? Also, It might be possible to consider Unit as 0 when the tester checks results.

Thank you.

[Session 1] March, 17th

Please do the following for the first online session.

[Session 7] April, 7th

Please do the following for the online session.

  • Watch the "Fuzzer" video: https://youtu.be/8gDIJdXutbo

  • Watch the "IRgen (Code, Variable Declaration)" video: https://youtu.be/HjARCUoK08s

  • Please ask questions if you don't understand some aspects of the lecture video. If you don't ask questions, I cannot help teaching too much material...

  • Solve the attendance quiz by 23:59PM, 7th of April: https://gg.kaist.ac.kr/quiz/7/

  • Homework 1(#8) and 2(#35) skeleton is being improved. Please merge the upstream changes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.