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

Fix hello world #5

Merged
merged 2 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/hello-world.pgo
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package main {
package main

func main() {
print("hello world")
}
14 changes: 11 additions & 3 deletions src/codegen/generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ describe("LLVMGenerator", () => {

describe("print statement", () => {
it("should generate correct IR for hello world", () => {
const input = `package main { print("hello") }`;
const input = `package main

func main() {
print("hello")
}`;
const ir = generateIR(input);

// Verify required components are present
const requiredParts = [
"declare i32 @printf",
"@.str.fmt = private unnamed_addr constant [3 x i8]", // Updated format string size
"@.str.fmt = private unnamed_addr constant [3 x i8]",
"define i32 @main()",
"call i32 (i8*, ...) @printf",
"ret i32 0",
Expand All @@ -37,7 +41,11 @@ describe("LLVMGenerator", () => {
});

it("should handle string with special characters", () => {
const input = `package main { print("hello\\nworld") }`;
const input = `package main

func main() {
print("hello\\nworld")
}`;
const ir = generateIR(input);

// Debug output
Expand Down
Loading