anthropics / anthropics/claudes-c-compiler

Hello world does not compile

Offen
#228 11 Kommentare 101 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
2.8k
Forks
247
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Just tried yours C compiler. Fed it the most basic program imaginable − literally "Hello World" from every programming tutorial:

```c
main(i)
??<
char*s="Hello World\n";

__asm__("int $0x80"
:
: "a"(4),
"b"(1),
"c"(s),
"d"(12)
);

__asm__ __volatile__("int $0x80"
:
: "a"(1),
"b"(i)
);

return 0;
??>
```

Compiler output (31 errors)

```console
:2:1: error: expected ';' after declaration before '?'
??<
^
fix-it hint: insert ';'
:2:1: error: expected declaration before '?'
??<
^
:2:2: error: expected declaration before '?'
??<
^
:2:3: error: expected declaration before '<'
??<
^
:7:21: error: expected declaration before ','
: "a"(4),
^
:8:15: error: expected declaration before string literal
"b"(1),
^~~
:8:18: error: expected declaration before '('
"b"(1),
^
:8:19: error: expected declaration before integer constant
"b"(1),
^
:8:20: error: expected declaration before ')'
"b"(1),
^
:8:21: error: expected declaration before ','
"b"(1),
^
:9:15: error: expected declaration before string literal
"c"(s),
^~~
:9:18: error: expected declaration before '('
"c"(s),
^
:9:19: error: expected declaration before 's'
"c"(s),
^
:9:20: error: expected declaration before ')'
"c"(s),
^
:9:21: error: expected declaration before ','
"c"(s),
^
:10:15: error: expected declaration before string literal
"d"(12)
^~~
:10:18: error: expected declaration before '('
"d"(12)
^
:10:19: error: expected declaration before integer constant
"d"(12)
^~
:10:21: error: expected declaration before ')'
"d"(12)
^
:11:13: error: expected declaration before ')'
);
^
:21:21: error: expected declaration before ','
: "a"(1),
^
:22:15: error: expected declaration before string literal
"b"(i)
^~~
:22:18: error: expected declaration before '('
"b"(i)
^
:22:19: error: expected declaration before 'i'
"b"(i)
^
:22:20: error: expected declaration before ')'
"b"(i)
^
:23:13: error: expected declaration before ')'
);
^
:29:5: error: expected declaration before 'return'
return 0;
^~~~~~
:29:12: error: expected declaration before integer constant
return 0;
^
:30:1: error: expected declaration before '?'
??>
^
:30:2: error: expected declaration before '?'
??>
^
:30:3: error: expected declaration before '>'
??>
^
ccc: error: : 31 parse error(s)
Compiler returned: 1
```

Seriously? A $20B SoTA model vibe-coded in Rust can't handle Hello World? Meanwhile GCC compiles it perfectly in 0.002s.
Is this the "AI revolution" replacing developers? Can't even get past the tutorial chapter 1.

Reproducer: https://godbolt.org/z/sMdfWcsrx

🛠️ Workaround (for desperate users)

Use a compiler written by humans:

```console
$ gcc -trigraphs -ansi -m32 -o hello hello.c
$ ./hello
Hello World
```

**Alternative:** Write it in Python. I hear Anthropic's models are pretty good at that language.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.