{"id":16101329,"url":"https://github.com/artemmukhin/minivalgrind","last_synced_at":"2025-03-18T07:31:26.189Z","repository":{"id":75892640,"uuid":"69994543","full_name":"artemmukhin/MiniValgrind","owner":"artemmukhin","description":"Simple tool for memory leak detection in programs written in simple C-like language","archived":false,"fork":false,"pushed_at":"2018-04-18T13:42:56.000Z","size":1647,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-10T20:53:49.082Z","etag":null,"topics":["bison","flex","interpreter","memory-leak","memory-leak-detection"],"latest_commit_sha":null,"homepage":"","language":"C++","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/artemmukhin.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":"2016-10-04T18:36:09.000Z","updated_at":"2023-11-17T18:51:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"d8fee62b-2338-4bd1-940b-55040ab60a31","html_url":"https://github.com/artemmukhin/MiniValgrind","commit_stats":null,"previous_names":["artemmukhin/minivalgrind"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemmukhin%2FMiniValgrind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemmukhin%2FMiniValgrind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemmukhin%2FMiniValgrind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemmukhin%2FMiniValgrind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artemmukhin","download_url":"https://codeload.github.com/artemmukhin/MiniValgrind/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243910814,"owners_count":20367545,"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":["bison","flex","interpreter","memory-leak","memory-leak-detection"],"created_at":"2024-10-09T18:49:38.015Z","updated_at":"2025-03-18T07:31:26.182Z","avatar_url":"https://github.com/artemmukhin.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MiniValgrind\nSimple tool for memory leak detection in programs written in simple C-like language (MiniC).\nLexer and parser are generated by Flex and Bison.\nWorks on Windows with Cygwin and on Linux.\n\n[Paper (in Russian)](http://ipo.spb.ru/journal/index.php?article/1905/)\n## Building\nRequires gcc, Flex and Bison\n```\n$ make\n```\n\n## Usage\n#### Run\n```\n$ ./MiniValgrind \u003c Tests/test1.txt\n```\n#### Output\nIf there are memory leaks in your program, you will see warning like this:\n```\nMemory leaks: 1 blocks, total size = 10 int\n```\nIf there are syntax errors in your program, you will see error like this:\n```\nsyntax error, line 2\n```\nIf there are runtime errors, you will see error like this:\n```\nError:    Invalid value's type\nAborted.\n```\n\n## Testing\nYou can run unit test:\n```\n$ python Tests/UnitTest.py\n```\nor memory test of MiniValgrind (requires original Valgrind)\n```\n$ python Test/MemoryTest.py\n```\n\n## MiniC overview\nMiniC program is enclosed between`#begin` and `#end`.\nAll MiniC programs must have a `main()` function — entry point of the program.\n\n#### Data types\nThere are three data types in MiniC: integer (`int`), pointer to integer (`ptr`) and array of integer (`arr`):\n```\nint x;\nint y = 15;\nptr p = \u0026x; // now *p == 15\n```\n`ptr` can be used as reference to array:\n```\narr a[2];\na[0] = 1;\na[1] = 2;\nptr p = a; // now p[0] == 1, p[1] == 2\np[0] = 5;  // now p[0] == a[0] == 5\n```\n\n#### Operators and statements\nArithmetic (`+, -, *, /, %, ++, --`), logical (`!, \u0026\u0026, ||`) and comparison operators (`\u003c, \u003c=, ==, \u003e=, \u003e, !=`) are similar to C.\n\nStatements: `if, for, while, return`:\n```\nif (x == y) {\n    while (x \u003c 10) {\n        z++;\n    }\nelse {\n    for (int i = 0; i \u003c 5; i++;) { // yes, there is a semicolon after i++\n        print(i);\n    }\n}\n\n```\n\n#### Functions\nMiniC has two manual memory management functions: `malloc` and `free` (similar to C):\n```\nptr p = malloc(10); // now it has p[0], ..., p[9]\nfree(p); // delete p[0], ..., p[9]\n```\nAlso MiniC has `print` function:\n```\nint x = 10;\nint y = 5;\nprint(2 * x + y + 7); // \"32\"\n```\nYou can define your own functions (return type may be `int`, `ptr` or `arr`):\n```\nint swap(ptr p, ptr q) {\n    int tmp = *p;\n    *p = *q;\n    *q = tmp;\n    return 0;\n}\n```\n\n#### Global variables\nYou can define global variables by using inside your program (i.e. between `#begin` and `#end`, out of any function):\n```\n#begin\nglobal {\n    int x = 3;\n    int y = 4;\n}\n\nint main() {\n    y++;\n    print(y); // \"5\"\n    return 0;\n}\n#end\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartemmukhin%2Fminivalgrind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartemmukhin%2Fminivalgrind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartemmukhin%2Fminivalgrind/lists"}