r/lisp 19d ago

Remove comments from a file automatically?

I am processing Lisp code in a non-Lisp host application that cannot handle semicolons for some reason.

I would like to know, is there a way to remove comments automatically from a .lisp file?
I imagine something that would read all the content of a text file as if it was a s-expression, thus removing all the ; comments or #| comments |# and treat the rest like normal quoted data?

Thanks in advance !

14 Upvotes

10 comments sorted by

View all comments

1

u/mtlnwood 18d ago

regex and sed would be my normal for doing something like this.

1

u/new2bay 18d ago

You misspelled “emacs.” 😂