Skip to content
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

Add solutions for advent of code 2024 day 1 to examples/. #4673

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

zygoloid
Copy link
Contributor

@zygoloid zygoloid commented Dec 12, 2024

In order to support these examples, this adds two new builtins to the toolchain: print.char and read.char, which map to the libc functions putchar and getchar.

@zygoloid zygoloid added the dependent Depends on another issue/PR label Dec 12, 2024
@zygoloid

This comment was marked as resolved.

@github-actions github-actions bot added documentation An issue or proposed change to our documentation infrastructure toolchain labels Dec 12, 2024
@github-actions github-actions bot requested a review from jonmeow December 12, 2024 20:51
examples/advent2024/day1_part2.carbon Outdated Show resolved Hide resolved
toolchain/check/eval.cpp Outdated Show resolved Hide resolved
toolchain/sem_ir/builtin_function_kind.def Outdated Show resolved Hide resolved
examples/advent2024/day1_part1.carbon Outdated Show resolved Hide resolved
toolchain/lower/handle_call.cpp Outdated Show resolved Hide resolved
@@ -0,0 +1,142 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files don't really have much in terms of documentation. Would it be worth at least adding a README.md explaining what you're doing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

@jonmeow jonmeow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the return type question you just asked -- consider me now neutral, the narrow delta of this change doesn't seem that bad to review. But, maybe fixing global variables should be in the PR title?

@zygoloid
Copy link
Contributor Author

Split the bugfix out to #4674.

This adds two new builtins to the toolchain: `print.char` and
`read.char`, which map to the libc functions `putchar` and `getchar`.

Also fixes a bug where global variables would create LLVM variable
declarations, not definitions, resulting in link errors.
prelude. Move the existing `Print` there too.
@zygoloid zygoloid removed the dependent Depends on another issue/PR label Dec 17, 2024
@zygoloid zygoloid enabled auto-merge December 17, 2024 00:34
@zygoloid zygoloid added this pull request to the merge queue Dec 17, 2024
Merged via the queue into carbon-language:trunk with commit 3645143 Dec 17, 2024
8 checks passed
@zygoloid zygoloid deleted the toolchain-aoc branch December 17, 2024 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation An issue or proposed change to our documentation infrastructure toolchain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants