BaseMax / Strip-C-Comments

A C program to strip comments from a c file and output the result to a new file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strip C-like Comments

A C program to strip comments from a c file and output the result to a new file.

Features

  • Fast and Without any third-party library
  • Without using Regex
  • Remove inline C-style comments
  • Remove multiline C-style comments
  • Trim whitespaces
  • Remove two or more empty lines

Build

gcc StripComments.c -o strip_comments

Using

If you are going to strip comments and get the results in stdout:

./strip_comments StripComments.c

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

./strip_comments StripComments.c StripComments.nocomments.c

TODO

  • Add Makefile or CMake (to set strip_comments in /user/bin/)

Anyone welcome to do contribute or extend the program to support Python comments too. (With a flag)

© Copyright Max Base, 2022

About

A C program to strip comments from a c file and output the result to a new file.

License:GNU General Public License v3.0


Languages

Language:C 98.6%Language:Python 1.4%