{"id":17193536,"url":"https://github.com/bl0ckeduser/new-bpf-tools","last_synced_at":"2025-04-13T19:31:10.913Z","repository":{"id":6022366,"uuid":"7246088","full_name":"bl0ckeduser/new-bpf-tools","owner":"bl0ckeduser","description":"subset-of-C compiler targeting 32-bit x86","archived":false,"fork":false,"pushed_at":"2023-04-22T14:55:16.000Z","size":1119,"stargazers_count":115,"open_issues_count":0,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T10:11:53.821Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bl0ckeduser.png","metadata":{"files":{"readme":"README","changelog":"ChangeLog","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":"2012-12-19T19:31:40.000Z","updated_at":"2024-05-19T15:06:44.000Z","dependencies_parsed_at":"2024-11-07T23:01:03.593Z","dependency_job_id":"cb15a4fd-ed4b-4e65-b871-8b1e1e9357cc","html_url":"https://github.com/bl0ckeduser/new-bpf-tools","commit_stats":{"total_commits":851,"total_committers":2,"mean_commits":425.5,"dds":0.001175088131609825,"last_synced_commit":"4067489313112c4866baacc684a6a8e79ab52a70"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bl0ckeduser%2Fnew-bpf-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bl0ckeduser%2Fnew-bpf-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bl0ckeduser%2Fnew-bpf-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bl0ckeduser%2Fnew-bpf-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bl0ckeduser","download_url":"https://codeload.github.com/bl0ckeduser/new-bpf-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248767873,"owners_count":21158548,"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":[],"created_at":"2024-10-15T01:44:23.585Z","updated_at":"2025-04-13T19:31:10.904Z","avatar_url":"https://github.com/bl0ckeduser.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"This project is a personal programming exercise. It consists mainly in\na compiler for a subset of C, targeting 32-bit x86 (via GNU assembler).\n\nThis 32-bit x86 compiler is tested on FreeBSD, GNU / Linux, and Windows\n(via the MinGW toolchain).\n\nThere is now very rough and still buggy support for amd64 code generation,\npresently only tested on GNU/Linux and FreeBSD (new as of January 2018).\nIt does not presently work on Windows/mingw64.\n\nThe 32-bit x86 version (and now also amd64 version) can compile itself !\n\nI started this in highschool in 2012 and the code has turned into a mess.\nI am now attending a CS program, since 2013, \u0026 if I started this project\nagain from scratch I should follow better development principles!\n\nThe code is not particularly maintainable or readable, this is what happens\nwhen an overzealous high school student wants to ``prove himself'' and\nwrites large amounts of code like an insane madman. \nProgramming is like a drug\nCorporate-quality code this ain't. but definitely i was enthusiastic and\nwilling, i suppose that is the point\n\nAlthough, I think the lexer and parser are not *that* bad. The codegen_x86 \nmodule is extremely nasty in a few parts, it has some very messy stuff when \nit sets up symbols. And there are few things that need to be refactored...\n\n\n\t---------------------- X86 QUICKSTART -----------------------\n\n\t\t$ cd compiler/\n\t\t$ ./build-x86.sh\n\t\t$ ./compile-run-x86.sh test/x86/recursive-fib.c \n\n\t  Note that 32-bit C libraries must be installed.\n\n\t-------------------------------------------------------------\n\nFor further info: please go in the \"compiler\" directory and read\n\"compiler/docs/docs-x86.txt\" for info about the supported C features,\nhow to build the program, etc.  (There is some other useful information\nin the \"compiler/docs\" directory, for example docs/wcc.txt tells you\nhow to build a standalone \"wcc\" command).\n\nThe test programs \"compiler/test/x86/*.c\" should give an idea of the\nsubset of C accepted at this point. Highlights include: pointers and\nmulti-dimensional arrays of structs, ints, and chars; structs with\nself-referential pointers; support for several libc calls (e.g. printf);\ncustom procedures with recursion allowed; for-loops; typedefs; string\nconstants; switch statements compiled to jump tables; (some) function\nprototypes; (some) array initializers.\n\nThere are still bugs, probably especially in constructs not yet tried\nin the test programs. Some expressions may not compile properly yet,\nor compile at all, for that matter. This is a work-in-progress. Big real\nserious professional or academic compilers likely use more sophisitcated\ntechniques; I'm doing this project to learn because I still have a lot\nto learn.\n\nI haven't read the standard. I'm mostly looking at gcc's x86 output and\nimitating that. It's not going to give a professional-quality standard\ncompiler but it will certainly be a good learning experience for me.\n\nThis really really really isn't an optimizing compiler!\n\n-------------------------------------------------------------------------\n\nThis compiler can also target my terrible old bytecode VM,\narbitrarily named \"BPF\" -- for details, see \"README-BPF\" and\n\"compiler/docs/docs-bpf.txt\"\n\nNote that the BPF compiler supports a much smaller subset of C than does\nthe x86 compiler, and it may have some weird modifications.\n\n-------------------------------------------------------------------------\n\nFuture project ideas:\n\nMIPS codegen (i'm learning MIPS at school as of early 2014)\n\nThe compiler could be improved, merged with a well-designed VM and hacked\ninto a big REPL to create a script interpreter.\n\nSupporting a larger subset of C ? Not sure if it would be possible to\ndo this by growing this code.\n\nSupport for other real architectures than x86, say e.g. powerpc or arm\n(PowerPC does not look easy.)\n\nSupport for popular serious VMs like JVM / .NET / LLVM\n\n-------------------------------------------------------------------------\n\nProject started: December 2012\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbl0ckeduser%2Fnew-bpf-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbl0ckeduser%2Fnew-bpf-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbl0ckeduser%2Fnew-bpf-tools/lists"}