Skip to content

compiler crash #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
404Dev-404 opened this issue Apr 6, 2025 · 4 comments
Open

compiler crash #42

404Dev-404 opened this issue Apr 6, 2025 · 4 comments

Comments

@404Dev-404
Copy link

i was reading the tutorial at https://cognate-lang.github.io/learn/ and tried to compile the code:

Let Even? (Zero? Modulo 2);
Let Evens Filter (Even?) Range 1 100;
Print Evens;

(literally just one of the examples without the lowercase words)

and got an error:

➜  ~ cognac test.cog && ./test
           ______                        ______
          / ____/___  ____ _____  ____ _/ ____/
         / /   / __ \/ __ `/ __ \/ __ `/ /
        / /___/ /_/ / /_/ / / / / /_/ / /___
        \____/\____/\__, /_/ /_/\__,_/\____/
                   /____/
                          Cognate Compiler



          ___  _
         / _ \| |__    _ __   ___
        | | | | '_ \  | '_ \ / _ \
        | |_| | | | | | | | | (_) |
         \___/|_| |_| |_| |_|\___/

        ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR

        The compiler has reached an unreachable state!
        This error is my fault not yours, so give
        yourself a pat on the back for finding a bug
        in the compiler - then submit a bug report!

        To make this easier, I'm including a handy
        backtrace:

cognac(+0x63ad) [0x60d213f263ad]
cognac(push_register_front+0x37) [0x60d213f27341]
cognac(shorten_references+0x3f) [0x60d213f2746f]
cognac(main+0x136) [0x60d213f2d3cf]
/usr/lib/libc.so.6(+0x27488) [0x785777c02488]
/usr/lib/libc.so.6(__libc_start_main+0x8c) [0x785777c0254c]
cognac(_start+0x25) [0x60d213f243a5]


^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^Cc[1]    269180 IOT instruction (core dumped)  cognac test.cog

(the ^Cs are from me trying to quit the compiler)

im running Arch Linux on kernel 6.13.8-zen1-1-zen

@hedyhli
Copy link
Collaborator

hedyhli commented Apr 6, 2025

Hello! I can't speak for the compiler error, but I just noticed the code in the example has a slight typo.Even? is already a block, and so the code should be:

Let Even? be (Zero? Modulo 2);
Let Evens be Filter Even? over Range 1 to 100;
Print Evens;

Tested on the JavaScript implementation with the online playground.

@404Dev-404
Copy link
Author

404Dev-404 commented Apr 6, 2025

the tutorial (https://cognate-lang.github.io/learn/) puts parentheses around Even?
Image

@hedyhli
Copy link
Collaborator

hedyhli commented Apr 6, 2025

Right, I meant to say the code in the tutorial might be in error.

@StavromulaBeta
Copy link
Collaborator

Ah of course this is in shorten_references. I've fixed the example on the website, and I'll try and patch the compiler in the next few weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants