{"id":22887754,"url":"https://github.com/alexp11223/minic","last_synced_at":"2025-05-07T11:21:50.262Z","repository":{"id":80410112,"uuid":"77704441","full_name":"AlexP11223/minic","owner":"AlexP11223","description":"A simple compiler for a C-like programming language to JVM bytecode. Kotlin, ANTLR","archived":false,"fork":false,"pushed_at":"2017-09-12T11:32:59.000Z","size":611,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T09:37:41.433Z","etag":null,"topics":["antlr","ast","compiler","compiler-design","jvm-bytecode","kotlin","parsing"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/AlexP11223.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","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-12-30T18:52:51.000Z","updated_at":"2025-03-10T16:43:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"72be860b-6a11-4a1d-9f8f-4da616660a1a","html_url":"https://github.com/AlexP11223/minic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexP11223%2Fminic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexP11223%2Fminic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexP11223%2Fminic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexP11223%2Fminic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexP11223","download_url":"https://codeload.github.com/AlexP11223/minic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252866123,"owners_count":21816397,"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":["antlr","ast","compiler","compiler-design","jvm-bytecode","kotlin","parsing"],"created_at":"2024-12-13T20:38:22.037Z","updated_at":"2025-05-07T11:21:50.228Z","avatar_url":"https://github.com/AlexP11223.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mini-C compiler\r\n\r\n[![Build Status](https://travis-ci.org/AlexP11223/minic.svg?branch=master)](https://travis-ci.org/AlexP11223/minic)\r\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.alexp11223/minic/badge.svg)](https://mvnrepository.com/artifact/com.github.alexp11223/minic)\r\n\r\nA simple compiler for a C-like programming language.\r\n\r\nIt has if-else statements, loops, variables (of int, double, bool or string types), arithmetic, comparison, logical operations, “functions” for user communications via stdin/stdout.\r\n\r\nImplemented in Kotlin, using ANTLR for parsing and ASM library for JVM bytecode output.\r\n\r\n# How to build\r\n\r\nRequirements:\r\n- JDK 8+.\r\n- Maven 3+.\r\n\r\nRun Maven **package** phase. This will download all dependencies, run JUnit tests and build JAR file + .exe and shell script. Check Maven output to see if all tests and build steps are completed successfully.\r\n\r\n(Maven is included in popular Java IDEs such as IntelliJ Idea or Eclipse. You can run it either via your IDE Maven plugin or from command line in separate [Maven installation](https://maven.apache.org/install.html): `mvn package`.)\r\n\r\n`dist/` folder will contain JAR file, .exe for Windows and shell script for Linux/MacOS (it simply executes the JAR file via `java`), as well as a sample source code file.\r\n \r\n Some of the tests launch `java`, using path from `System.getProperty(\"java.home\")`. Fallbacks to `java` (from PATH environment variable) if it is not found.\r\n \r\n# Usage\r\n \r\n 1. `cd dist/minic-dist`\r\n 2. Run `minic  \u003cparameters\u003e` (via shell script or Windows .exe) or `java -jar minic.jar \u003cparameters\u003e`.\r\n \r\nIf launched without parameters, it reads input from stdin until EOF (Ctrl+D, or Ctrl+Z for Windows), compiles and runs the program.\r\n \r\nAlso it is possible to specify input and output files: \r\n\r\n```\r\nminic [input_file [output_file]] [options]\r\n```\r\n\r\n**input_file** is path (or name) of file with Mini-C source code.\r\n\r\n**output_file** is path (or name) of output file with JVM bytecode. Optional. If not specified, _input_file_ without extension will be used. **.class** extension is appended if not present (otherwise `java` will not run it), such as MyProgram.class.\r\n\r\nOptions:\r\n\r\n**--ast** [png_output_file]: draw AST and save as PNG image (default ast.png).\r\n\r\n**--tokens**: output lexer tokens.\r\n\r\n**--bytecode**: output bytecode as text. Only the main code, not the whole generated class. Also not includes frames map.\r\n\r\n**--debug**, **-d**: adds additional information, such as source code line numbers in bytecode.\r\n\r\n**--decompiled_bytecode**: The same as *--bytecode* but extracts bytecode from generated result instead of writing it during codegen, and includes frames map.\r\n\r\nExample:\r\n\r\n```\r\nminic MyProgram.mc\r\n```\r\nor\r\n```\r\nminic MyProgram.mc MyProgram\r\n```\r\nand\r\n```\r\njava MyProgram\r\n```\r\n\r\nAdditional output:\r\n\r\n```\r\nminic MyProgram.mc --ast my_ast.png --tokens --bytecode --decompiled_bytecode\r\n```\r\n\r\n```\r\nminic MyProgram.mc --bytecode --debug\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexp11223%2Fminic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexp11223%2Fminic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexp11223%2Fminic/lists"}