A Transducer for Removing Comments in a file

Automata generated using Graphwiz API

The workflow of stripping comments from a C file from a file can be modelled using the following automata

  • Set of States = {S0,S1,S2,S3,S4}
  • Set of alphabets(A) = {set of all ascii characters }
  • Start State = S0
  • End State = S4

This can be converted to a transducer such that whenever the System reaches state 0 , the character is printed on console

I have developed a program for stripping coments based on this automata. The automate on the left was generated using GraphViz. See https://varrunr.wordpress.com/2009/12/10/modelling-automata-using-graphwiz-api/ for more.

You can download it here ( git repository)


Run as

$ ./ strip_comment <input_file>

The Documentation was generated with Doxygen and is present in Doc folder

License : GPL

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s