{"id":16221580,"url":"https://github.com/ehwan/c-language-parser-in-rust","last_synced_at":"2026-03-01T23:31:29.234Z","repository":{"id":242656071,"uuid":"809019261","full_name":"ehwan/C-language-Parser-In-Rust","owner":"ehwan","description":"C language lexer \u0026 parser \u0026 virtual interpreter from scratch in Rust","archived":false,"fork":false,"pushed_at":"2024-11-20T01:36:48.000Z","size":2202,"stargazers_count":24,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T01:53:19.753Z","etag":null,"topics":["abstract-syntax-tree","c","code-generation","compiler","interpreter","lexer","parser","rust","rust-lang","tokenizer","tokenizer-parser","virtual-machine"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ehwan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-01T13:03:35.000Z","updated_at":"2025-01-09T02:58:47.000Z","dependencies_parsed_at":"2024-06-04T09:11:29.503Z","dependency_job_id":"76e5add8-e151-40b3-b84a-a6cd894324c3","html_url":"https://github.com/ehwan/C-language-Parser-In-Rust","commit_stats":null,"previous_names":["ehwan/c-parser-in-rust"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehwan%2FC-language-Parser-In-Rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehwan%2FC-language-Parser-In-Rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehwan%2FC-language-Parser-In-Rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehwan%2FC-language-Parser-In-Rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ehwan","download_url":"https://codeload.github.com/ehwan/C-language-Parser-In-Rust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243862654,"owners_count":20360185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abstract-syntax-tree","c","code-generation","compiler","interpreter","lexer","parser","rust","rust-lang","tokenizer","tokenizer-parser","virtual-machine"],"created_at":"2024-10-10T12:08:57.854Z","updated_at":"2026-03-01T23:31:29.228Z","avatar_url":"https://github.com/ehwan.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C language lexer \u0026 parser \u0026 virtual executer written in Rust\n\nC language lexer \u0026 parser \u0026 virtual executer from scratch in Rust.\n\n## Features\n - Tokenizer (Lexer)\n - Preprocessor\n - Parser ( AST Builder, LR(1) parser using [RustyLR](https://github.com/ehwan/RustyLR) )\n - Virtual Machine ( LLVM via [inkwell](https://github.com/TheDan64/inkwell) )\n\n## How it works\n### Phase 1: Tokenizing\nTokenize the raw source code into a list of tokens.\nThis phase will remove c/cpp comments.\nSequence of whitespaces will be combined into one `Token::Whitespace`\nThe newline `\\n` will be kept as a `Token::NewLine` for later phase\nIf the source is not end with `\\n`, it will be added automatically\n\n### Phase 2: Line Analysis\nAnalyze the tokens in each line and generate a list of `Line` which contains the result of the analysis. This phase will extract preprocessor directives and macro definitions.\n\n### Phase 3: Preprocessing\nPreprocess the source code by expanding macros and removing preprocessor directives.\n\n### Phase 4: Building AbstractSyntaxTree\nBuild an Abstract Syntax Tree (AST) from the preprocessed token stream. The AST will be used to generate instructions.\n\n### Phase 5: Semantic Analysis\nIterate through the AST and check for semantic errors, such as type mismatches and undeclared variables.\n\n### Phase 6: LLVM linkage\nGenerate LLVM IR from the AST and execute it using the LLVM JIT compiler.\n\n## How to run\n```sh\ncargo run\n```\n To execute the program, pass the C code to stdin. \n Once you are done, press ^D to finish the input. The program will tokenize, parse, generate instructions, and execute the code.\n\n\nSample C codes (only with implemented features) are in `samples/` directory. Try them with `cat samples/sample.c | cargo run`\n\n## Example\n```c\n/// samples/sample.c\n\nextern int printf(const char *fmt, ...);\n\n// declaration of function fibonacci sequence\nint fibonacci(int);\n\n#define MY_MACRO_FUNC(x, y) y + x\n\n#if MY_MACRO_FUNC(1, 2) == 3\n\n// main function\nint main() {\n  int var = 10;\n  int *ptr = \u0026var;\n  printf(\"Hello, World!\\n\");\n  *ptr = MY_MACRO_FUNC(40, 60);\n  printf(\"%p, %d, %d\\n\", (void *)ptr, *ptr, var);\n\n  printf(\"%d\\n\", MY_MACRO_FUNC(10, 20));\n\n  // print fibonacci sequence\n  printf(\"%s\\n\", \"Fibonacci sequence:\");\n  int i = 1;\n  for (i = 1; i \u003c= 10; i++) {\n    printf(\"for i = %d, \", i);\n    printf(\"%d\\n\", fibonacci(i));\n  }\n\n  return 0;\n}\n\n// definition of function fibonacci sequence using recursion\nint fibonacci(int n) {\n  if (n \u003c= 2)\n    return 1;\n  else\n    return fibonacci(n - 1) + fibonacci(n - 2);\n}\n\n#else\n\nTHIS WILL BE IGNORED\n\n#endif\n```\n\nPass c code to stdin\n```sh\ncat samples/sample.c | cargo run\n```\n\nThe result will be:\n\n```\nEnter your code (and ^D for EOF):\n================================================================================\n===============================Phase1: Tokenizing===============================\n================================================================================\nLINE | ---------------------------------Result----------------------------------\n   0: Identifier(\"extern\") Whitespace Identifier(\"int\") Whitespace Identifier(\"printf\") LeftParen Identifier(\"const\") Whitespace Identifier(\"char\") Whitespace Star Identifier(\"fmt\") Comma Whitespace Ellipsis RightParen SemiColon \n   1: \n   2: \n   3: Identifier(\"int\") Whitespace Identifier(\"fibonacci\") LeftParen Identifier(\"int\") RightParen SemiColon \n   4: \n   5: PreprocessorDefine Whitespace Identifier(\"MY_MACRO_FUNC\") LeftParen Identifier(\"x\") Comma Whitespace Identifier(\"y\") RightParen Whitespace Identifier(\"y\") Whitespace Plus Whitespace Identifier(\"x\") \n   6: \n   7: PreprocessorIf Whitespace Identifier(\"MY_MACRO_FUNC\") LeftParen ConstantInteger(1) Comma Whitespace ConstantInteger(2) RightParen Whitespace EqOp Whitespace ConstantInteger(3) \n   8: \n   9: \n  10: Identifier(\"int\") Whitespace Identifier(\"main\") LeftParen RightParen Whitespace LeftBrace \n  11: Whitespace Identifier(\"int\") Whitespace Identifier(\"var\") Whitespace Equal Whitespace ConstantInteger(10) SemiColon \n  12: Whitespace Identifier(\"int\") Whitespace Star Identifier(\"ptr\") Whitespace Equal Whitespace Ampersand Identifier(\"var\") SemiColon \n  13: Whitespace Identifier(\"printf\") LeftParen StringLiteral(\"Hello, World!\\n\") RightParen SemiColon \n  14: Whitespace Star Identifier(\"ptr\") Whitespace Equal Whitespace Identifier(\"MY_MACRO_FUNC\") LeftParen ConstantInteger(40) Comma Whitespace ConstantInteger(60) RightParen SemiColon \n  15: Whitespace Identifier(\"printf\") LeftParen StringLiteral(\"%p, %d, %d\\n\") Comma Whitespace LeftParen Identifier(\"void\") Whitespace Star RightParen Identifier(\"ptr\") Comma Whitespace Star Identifier(\"ptr\") Comma Whitespace Identifier(\"var\") RightParen SemiColon \n  16: \n  17: Whitespace Identifier(\"printf\") LeftParen StringLiteral(\"%d\\n\") Comma Whitespace Identifier(\"MY_MACRO_FUNC\") LeftParen ConstantInteger(10) Comma Whitespace ConstantInteger(20) RightParen RightParen SemiColon \n  18: \n  19: Whitespace \n  20: Whitespace Identifier(\"printf\") LeftParen StringLiteral(\"%s\\n\") Comma Whitespace StringLiteral(\"Fibonacci sequence:\") RightParen SemiColon \n  21: Whitespace Identifier(\"int\") Whitespace Identifier(\"i\") Whitespace Equal Whitespace ConstantInteger(1) SemiColon \n  22: Whitespace Identifier(\"for\") Whitespace LeftParen Identifier(\"i\") Whitespace Equal Whitespace ConstantInteger(1) SemiColon Whitespace Identifier(\"i\") Whitespace LeOp Whitespace ConstantInteger(10) SemiColon Whitespace Identifier(\"i\") IncOp RightParen Whitespace LeftBrace \n  23: Whitespace Identifier(\"printf\") LeftParen StringLiteral(\"for i = %d, \") Comma Whitespace Identifier(\"i\") RightParen SemiColon \n  24: Whitespace Identifier(\"printf\") LeftParen StringLiteral(\"%d\\n\") Comma Whitespace Identifier(\"fibonacci\") LeftParen Identifier(\"i\") RightParen RightParen SemiColon \n  25: Whitespace RightBrace \n  26: \n  27: Whitespace Identifier(\"return\") Whitespace ConstantInteger(0) SemiColon \n  28: RightBrace \n  29: \n  30: \n  31: Identifier(\"int\") Whitespace Identifier(\"fibonacci\") LeftParen Identifier(\"int\") Whitespace Identifier(\"n\") RightParen Whitespace LeftBrace \n  32: Whitespace Identifier(\"if\") Whitespace LeftParen Identifier(\"n\") Whitespace LeOp Whitespace ConstantInteger(2) RightParen \n  33: Whitespace Identifier(\"return\") Whitespace ConstantInteger(1) SemiColon \n  34: Whitespace Identifier(\"else\") \n  35: Whitespace Identifier(\"return\") Whitespace Identifier(\"fibonacci\") LeftParen Identifier(\"n\") Whitespace Minus Whitespace ConstantInteger(1) RightParen Whitespace Plus Whitespace Identifier(\"fibonacci\") LeftParen Identifier(\"n\") Whitespace Minus Whitespace ConstantInteger(2) RightParen SemiColon \n  36: RightBrace \n  37: \n  38: PreprocessorElse \n  39: \n  40: Identifier(\"THIS\") Whitespace Identifier(\"WILL\") Whitespace Identifier(\"BE\") Whitespace Identifier(\"IGNORED\") \n  41: \n  42: PreprocessorEndIf \n================================================================================\n=============================Phase2: Line Analysis==============================\n================================================================================\nLINE | ---------------------------------Result----------------------------------\n   0: RawTokens { tokens: [Identifier(\"extern\"), Identifier(\"int\"), Identifier(\"printf\"), LeftParen, Identifier(\"const\"), Identifier(\"char\"), Star, Identifier(\"fmt\"), Comma, Ellipsis, RightParen, SemiColon] }\n   1: RawTokens { tokens: [Identifier(\"int\"), Identifier(\"fibonacci\"), LeftParen, Identifier(\"int\"), RightParen, SemiColon] }\n   2: DefineFunction { name: \"MY_MACRO_FUNC\", param_count: 2, replacement: [PreprocessorPlaceholder(1), Plus, PreprocessorPlaceholder(0)] }\n   3: If { expression_tokens: [Identifier(\"MY_MACRO_FUNC\"), LeftParen, ConstantInteger(1), Comma, ConstantInteger(2), RightParen, EqOp, ConstantInteger(3)] }\n   4: RawTokens { tokens: [Identifier(\"int\"), Identifier(\"main\"), LeftParen, RightParen, LeftBrace] }\n   5: RawTokens { tokens: [Identifier(\"int\"), Identifier(\"var\"), Equal, ConstantInteger(10), SemiColon] }\n   6: RawTokens { tokens: [Identifier(\"int\"), Star, Identifier(\"ptr\"), Equal, Ampersand, Identifier(\"var\"), SemiColon] }\n   7: RawTokens { tokens: [Identifier(\"printf\"), LeftParen, StringLiteral(\"Hello, World!\\n\"), RightParen, SemiColon] }\n   8: RawTokens { tokens: [Star, Identifier(\"ptr\"), Equal, Identifier(\"MY_MACRO_FUNC\"), LeftParen, ConstantInteger(40), Comma, ConstantInteger(60), RightParen, SemiColon] }\n   9: RawTokens { tokens: [Identifier(\"printf\"), LeftParen, StringLiteral(\"%p, %d, %d\\n\"), Comma, LeftParen, Identifier(\"void\"), Star, RightParen, Identifier(\"ptr\"), Comma, Star, Identifier(\"ptr\"), Comma, Identifier(\"var\"), RightParen, SemiColon] }\n  10: RawTokens { tokens: [Identifier(\"printf\"), LeftParen, StringLiteral(\"%d\\n\"), Comma, Identifier(\"MY_MACRO_FUNC\"), LeftParen, ConstantInteger(10), Comma, ConstantInteger(20), RightParen, RightParen, SemiColon] }\n  11: RawTokens { tokens: [Identifier(\"printf\"), LeftParen, StringLiteral(\"%s\\n\"), Comma, StringLiteral(\"Fibonacci sequence:\"), RightParen, SemiColon] }\n  12: RawTokens { tokens: [Identifier(\"int\"), Identifier(\"i\"), Equal, ConstantInteger(1), SemiColon] }\n  13: RawTokens { tokens: [Identifier(\"for\"), LeftParen, Identifier(\"i\"), Equal, ConstantInteger(1), SemiColon, Identifier(\"i\"), LeOp, ConstantInteger(10), SemiColon, Identifier(\"i\"), IncOp, RightParen, LeftBrace] }\n  14: RawTokens { tokens: [Identifier(\"printf\"), LeftParen, StringLiteral(\"for i = %d, \"), Comma, Identifier(\"i\"), RightParen, SemiColon] }\n  15: RawTokens { tokens: [Identifier(\"printf\"), LeftParen, StringLiteral(\"%d\\n\"), Comma, Identifier(\"fibonacci\"), LeftParen, Identifier(\"i\"), RightParen, RightParen, SemiColon] }\n  16: RawTokens { tokens: [RightBrace] }\n  17: RawTokens { tokens: [Identifier(\"return\"), ConstantInteger(0), SemiColon] }\n  18: RawTokens { tokens: [RightBrace] }\n  19: RawTokens { tokens: [Identifier(\"int\"), Identifier(\"fibonacci\"), LeftParen, Identifier(\"int\"), Identifier(\"n\"), RightParen, LeftBrace] }\n  20: RawTokens { tokens: [Identifier(\"if\"), LeftParen, Identifier(\"n\"), LeOp, ConstantInteger(2), RightParen] }\n  21: RawTokens { tokens: [Identifier(\"return\"), ConstantInteger(1), SemiColon] }\n  22: RawTokens { tokens: [Identifier(\"else\")] }\n  23: RawTokens { tokens: [Identifier(\"return\"), Identifier(\"fibonacci\"), LeftParen, Identifier(\"n\"), Minus, ConstantInteger(1), RightParen, Plus, Identifier(\"fibonacci\"), LeftParen, Identifier(\"n\"), Minus, ConstantInteger(2), RightParen, SemiColon] }\n  24: RawTokens { tokens: [RightBrace] }\n  25: Else\n  26: RawTokens { tokens: [Identifier(\"THIS\"), Identifier(\"WILL\"), Identifier(\"BE\"), Identifier(\"IGNORED\")] }\n  27: EndIf\n================================================================================\n=============================Phase3: Preprocessing==============================\n================================================================================\nLINE | ---------------------------------Result----------------------------------\n   0: [Extern, Int, Identifier(\"printf\"), LeftParen, Const, Char, Star, Identifier(\"fmt\"), Comma, Ellipsis, RightParen, SemiColon]\n   1: [Int, Identifier(\"fibonacci\"), LeftParen, Int, RightParen, SemiColon]\n   2: [Int, Identifier(\"main\"), LeftParen, RightParen, LeftBrace]\n   3: [Int, Identifier(\"var\"), Equal, ConstantInteger(10), SemiColon]\n   4: [Int, Star, Identifier(\"ptr\"), Equal, Ampersand, Identifier(\"var\"), SemiColon]\n   5: [Identifier(\"printf\"), LeftParen, StringLiteral(\"Hello, World!\\n\"), RightParen, SemiColon]\n   6: [Star, Identifier(\"ptr\"), Equal, ConstantInteger(60), Plus, ConstantInteger(40), SemiColon]\n   7: [Identifier(\"printf\"), LeftParen, StringLiteral(\"%p, %d, %d\\n\"), Comma, LeftParen, Void, Star, RightParen, Identifier(\"ptr\"), Comma, Star, Identifier(\"ptr\"), Comma, Identifier(\"var\"), RightParen, SemiColon]\n   8: [Identifier(\"printf\"), LeftParen, StringLiteral(\"%d\\n\"), Comma, ConstantInteger(20), Plus, ConstantInteger(10), RightParen, SemiColon]\n   9: [Identifier(\"printf\"), LeftParen, StringLiteral(\"%s\\n\"), Comma, StringLiteral(\"Fibonacci sequence:\"), RightParen, SemiColon]\n  10: [Int, Identifier(\"i\"), Equal, ConstantInteger(1), SemiColon]\n  11: [For, LeftParen, Identifier(\"i\"), Equal, ConstantInteger(1), SemiColon, Identifier(\"i\"), LeOp, ConstantInteger(10), SemiColon, Identifier(\"i\"), IncOp, RightParen, LeftBrace]\n  12: [Identifier(\"printf\"), LeftParen, StringLiteral(\"for i = %d, \"), Comma, Identifier(\"i\"), RightParen, SemiColon]\n  13: [Identifier(\"printf\"), LeftParen, StringLiteral(\"%d\\n\"), Comma, Identifier(\"fibonacci\"), LeftParen, Identifier(\"i\"), RightParen, RightParen, SemiColon]\n  14: [RightBrace]\n  15: [Return, ConstantInteger(0), SemiColon]\n  16: [RightBrace]\n  17: [Int, Identifier(\"fibonacci\"), LeftParen, Int, Identifier(\"n\"), RightParen, LeftBrace]\n  18: [If, LeftParen, Identifier(\"n\"), LeOp, ConstantInteger(2), RightParen]\n  19: [Return, ConstantInteger(1), SemiColon]\n  20: [Else]\n  21: [Return, Identifier(\"fibonacci\"), LeftParen, Identifier(\"n\"), Minus, ConstantInteger(1), RightParen, Plus, Identifier(\"fibonacci\"), LeftParen, Identifier(\"n\"), Minus, ConstantInteger(2), RightParen, SemiColon]\n  22: [RightBrace]\n================================================================================\n======================Phase4: Building AbstractSyntaxTree=======================\n================================================================================\nASTs: \nTranslationUnit {\n    statements: [\n        Declaration(\n            StmtDeclaration {\n                specs: [\n                    StorageClassSpecifier(\n                        Extern,\n                    ),\n                    TypeSpecifier(\n                        Int,\n                    ),\n                ],\n                inits: Some(\n                    [\n                        DeclInit {\n                            declarator: Function(\n                                ...\n                                ...\n                                ...\n                                                            ),\n                                                        },\n                                                    ),\n                                                ),\n                                            },\n                                        ),\n                                    ),\n                                },\n                            ),\n                        ],\n                    },\n                ),\n            },\n        ),\n    ],\n}\n================================================================================\n===========================Phase5: Semantic Analysis============================\n================================================================================\nTranslationUnit {\n    statements: [],\n    variables: {\n        \"printf\": VariableInfo {\n            name: \"printf\",\n            uid: 1,\n            cv_type: CVType {\n                type_: Function(\n                    FunctionType {\n                        return_type: CVType {\n                            type_: Integer(\n                                Int32,\n                            ),\n                            const_: false,\n                            volatile: false,\n                        },\n                        args: [\n                            CombinedDeclarator {\n                                name: Some(\n                                    \"fmt\",\n                                ),\n                                cv_type: CVType {\n                                    type_: Pointer(\n                                        ...\n                                        ...\n                                        ...\n                                                        ),\n                                                    },\n                                                ),\n                                            ),\n                                        },\n                                    ),\n                                ),\n                            },\n                        ),\n                    ],\n                },\n            ),\n            type_: FunctionType {\n                return_type: CVType {\n                    type_: Integer(\n                        Int32,\n                    ),\n                    const_: false,\n                    volatile: false,\n                },\n                args: [\n                    CombinedDeclarator {\n                        name: Some(\n                            \"n\",\n                        ),\n                        cv_type: CVType {\n                            type_: Integer(\n                                Int32,\n                            ),\n                            const_: false,\n                            volatile: false,\n                        },\n                    },\n                ],\n                variadic: false,\n            },\n            uid: 2,\n            args: [\n                VariableInfo {\n                    name: \"n\",\n                    uid: 7,\n                    cv_type: CVType {\n                        type_: Integer(\n                            Int32,\n                        ),\n                        const_: false,\n                        volatile: false,\n                    },\n                    storage: None,\n                },\n            ],\n        },\n    },\n}\n================================================================================\n========================Phase6: Generating Instructions=========================\n================================================================================\n; ModuleID = 'main_module'\nsource_filename = \"main_module\"\ntarget datalayout = \"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128\"\n\n@str = private unnamed_addr constant [15 x i8] c\"Hello, World!\\0A\\00\", align 1\n@str.1 = private unnamed_addr constant [12 x i8] c\"%p, %d, %d\\0A\\00\", align 1\n@str.2 = private unnamed_addr constant [4 x i8] c\"%d\\0A\\00\", align 1\n@str.3 = private unnamed_addr constant [4 x i8] c\"%s\\0A\\00\", align 1\n@str.4 = private unnamed_addr constant [20 x i8] c\"Fibonacci sequence:\\00\", align 1\n@str.5 = private unnamed_addr constant [13 x i8] c\"for i = %d, \\00\", align 1\n@str.6 = private unnamed_addr constant [4 x i8] c\"%d\\0A\\00\", align 1\n\ndeclare i32 @printf(i8* %0, ...)\n\ndefine i32 @fibonacci(i32 %0) {\nfunc_block:\n  %n = alloca i32, align 4\n  store i32 %0, i32* %n, align 4\n  %load = load i32, i32* %n, align 4\n  %sle = icmp sle i32 %load, 2\n  %zext = zext i1 %sle to i8\n  %ifcond = icmp ne i8 %zext, 0\n  br i1 %ifcond, label %then_block, label %else_block\n\nthen_block:                                       ; preds = %func_block\n  ret i32 1\n\nelse_block:                                       ; preds = %func_block\n  %load1 = load i32, i32* %n, align 4\n  %sub = sub i32 %load1, 1\n  %function_call = call i32 @fibonacci(i32 %sub)\n  %load2 = load i32, i32* %n, align 4\n  %sub3 = sub i32 %load2, 2\n  %function_call4 = call i32 @fibonacci(i32 %sub3)\n  %add = add i32 %function_call, %function_call4\n  ret i32 %add\n\nmerge_block:                                      ; No predecessors!\n}\n\ndefine i32 @main() {\nfunc_block:\n  %var = alloca i32, align 4\n  store i32 10, i32* %var, align 4\n  %ptr = alloca i32*, align 8\n  store i32* %var, i32** %ptr, align 8\n  %function_call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str, i32 0, i32 0))\n  %load = load i32*, i32** %ptr, align 8\n  store i32 100, i32* %load, align 4\n  %load1 = load i32*, i32** %ptr, align 8\n  %ptr_ptr = bitcast i32* %load1 to i8*\n  %load2 = load i32*, i32** %ptr, align 8\n  %load3 = load i32, i32* %load2, align 4\n  %load4 = load i32, i32* %var, align 4\n  %function_call5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.1, i32 0, i32 0), i8* %ptr_ptr, i32 %load3, i32 %load4)\n  %function_call6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.2, i32 0, i32 0), i32 30)\n  %function_call7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.4, i32 0, i32 0))\n  %i = alloca i32, align 4\n  store i32 1, i32* %i, align 4\n  store i32 1, i32* %i, align 4\n  br label %body_block\n\nbody_block:                                       ; preds = %continue_block, %func_block\n  %load8 = load i32, i32* %i, align 4\n  %function_call9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @str.5, i32 0, i32 0), i32 %load8)\n  %load10 = load i32, i32* %i, align 4\n  %function_call11 = call i32 @fibonacci(i32 %load10)\n  %function_call12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i32 0, i32 0), i32 %function_call11)\n  br label %continue_block\n\ncontinue_block:                                   ; preds = %body_block\n  %load13 = load i32, i32* %i, align 4\n  %inc = add i32 %load13, 1\n  store i32 %inc, i32* %i, align 4\n  %load14 = load i32, i32* %i, align 4\n  %sle = icmp sle i32 %load14, 10\n  %zext = zext i1 %sle to i8\n  %ifcond = icmp ne i8 %zext, 0\n  br i1 %ifcond, label %body_block, label %break_block\n\nbreak_block:                                      ; preds = %continue_block\n  ret i32 0\n}\n\n\nProgram returned: 0\nHello, World!\n0x7ffc4f2c0a04, 100, 100\n30\nFibonacci sequence:\nfor i = 1, 1\nfor i = 2, 1\nfor i = 3, 2\nfor i = 4, 3\nfor i = 5, 5\nfor i = 6, 8\nfor i = 7, 13\nfor i = 8, 21\nfor i = 9, 34\nfor i = 10, 55\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehwan%2Fc-language-parser-in-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fehwan%2Fc-language-parser-in-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehwan%2Fc-language-parser-in-rust/lists"}