Coder Social home page Coder Social logo

basemax / c-minifier Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 1.0 55 KB

CMinifier: A C program to remove comments and minimize the code (remove whitespace and summarize code)

License: GNU General Public License v3.0

C 100.00%
c minifier minifiers minifier-c c-minifier minify minify-c minifying

c-minifier's Introduction

C Minifier

A C program to remove comments and minimize the code (remove whitespace and summarize code)

Features

  • Supporting most C keywords and automatically add space after these, such as: if, else, int, long, float, bool, sizeof
  • Supporting macro statements #include and others
  • Fast and Without any third-party library
  • Without using Regex
  • Remove inline C-style comments
  • Remove multiline C-style comments
  • Trim whitespaces
  • Remove empty lines

Build

$ gcc Minifier.c -o minifier

Using

If you are going to minify A C program and get the results in stdout:

./minifier Minifier.c

And maybe sometime you need to write the result in another or same file:

./minifier Minifier.c o.c

TODO

  • Adding more C keywords if needed or missed
  • Automatically rename and make short identifier names (A hash-map list to keep original name and new random name and a function to generate a short (and unique) name)

Welcome to help and feel free to contribute and send Pull request.

Please open a issue if you find a bug and not have time to fix. Thanks in advance.

© Copyright Max Base, 2022

c-minifier's People

Contributors

basemax avatar therealolie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

onlykood

c-minifier's Issues

Supporting all C keywords

List:

auto | break | case | char | const |
                        continue | default | do | double | else |
                        enum | extern | float | for | goto |
                        if | int | long | register | return |
                        short | signed | sizeof | static | struct |
                        switch | typedef | union | unsigned | void |
                        volatile | while

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.