https://github.com/eyuelberga/decomment-program-c
C program to remove comments from source-code
https://github.com/eyuelberga/decomment-program-c
c c-programming c-project dfa python
Last synced: 2 months ago
JSON representation
C program to remove comments from source-code
- Host: GitHub
- URL: https://github.com/eyuelberga/decomment-program-c
- Owner: eyuelberga
- License: mit
- Created: 2021-10-26T19:32:43.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-26T19:36:29.000Z (over 4 years ago)
- Last Synced: 2025-03-22T11:48:09.115Z (over 1 year ago)
- Topics: c, c-programming, c-project, dfa, python
- Language: C
- Homepage:
- Size: 131 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# De-Comment Program
C program to remove comments from source-code
## DFA Design
The deterministic finite state automaton (DFA) expresses the required de-commenting logic. The DFA is represented using the traditional "labeled ovals and labeled arrows" notation. Each oval represent a state. Each state is given short name with detailed descriptions of the left. Each arrow represent a transition from one state to another. Each arrow is labeled with the single character that causes the transition to occur.

## Build
You can compile the program using `gcc`.
```shell
$ gcc decomment.c -o decomment
```
## Usage
```shell
$ ./decomment
```
- If the program is run without argument, the code to be decommented will be read from the
standard input and displayed[decommented code] on the standard output
- If argument is given, the code to be decommented will be read form the file and displayed in
the standard output.
## Test
`test.py` contains a simple script to run the compiled `decomment` program and compare the standard output
against expected output values. To run, execute run the following command after compiling the `decomment`
program:
```shell
$ python test.py
```
## License
MIT © [Eyuel Berga](https://github.com/eyuelberga)