[net.micro.amiga] more on Lattice working environment

umetcalf@yale.ARPA (Chris Metcalf) (01/02/86)

Another brief note on arranging your working disks for Lattice.  Someone
pointed out that you could remove comments and such from the include files
to gain space; this also gains compile-time speed, so it's doubly good.
I wrote some code to strip comments out of files in this fashion.  Almost
exactly half of the files in the include directory turn out to be
disposable...  This gives you about 144K more on your compiler disk.

If anyone is interested in my quickly-hacked code trimmer, drop me a line.
It's an interesting exercise:  removing comments from code is actually
somewhat nontrivial.

Chris
-- 
Chris Metcalf (umetcalf@yale-cheops.arpa)	..!decvax!yale!umetcalf

hamilton@uiucuxc.CSO.UIUC.EDU (01/06/86)

>If anyone is interested in my quickly-hacked code trimmer, drop me a line.
>It's an interesting exercise:  removing comments from code is actually
>somewhat nontrivial.

i don't want to steal your thunder or anything, but i thought this might
be amusing with respect to your 'nontrivial' comment.  of course, it assumes
you've got lex handy:

%{
/* this Lex script generates a filter that removes comments from C sources.
 * to compile:
 *	lex -t < {this text} > comments.c
 *	cc -o comments comments.c -ll
 * to use:
 *	comments < {C source} > {uncommented C source}
 */
%}
%Start INSIDE
%%
<INSIDE>"*/"	{ BEGIN 0; }
<INSIDE>"/*"	{ fprintf(stderr,"unbalanced /*!\n"); }
<INSIDE>.	{ }
"/*"		{ BEGIN INSIDE; }
"*/"		{ fprintf(stderr,"unbalanced */!\n"); }
.		{ ECHO; }

	wayne hamilton
	U of Il and US Army Corps of Engineers CERL
UUCP:	{ihnp4,pur-ee,convex}!uiucdcs!uiucuxc!hamilton
ARPA:	hamilton@uiucuxc.cso.uiuc.edu
CSNET:	hamilton%uiucuxc@uiuc.csnet
USMail:	Box 476, Urbana, IL 61801
Phone:	(217)333-8703

tim@ism780c.UUCP (Tim Smith) (01/08/86)

In article <148600030@uiucuxc> hamilton@uiucuxc.CSO.UIUC.EDU writes:
>
>>It's an interesting exercise:  removing comments from code is actually
>>somewhat nontrivial.
>
>i don't want to steal your thunder or anything, but i thought this might
>be amusing with respect to your 'nontrivial' comment.  of course, it assumes
>you've got lex handy:
>
> [ attempt to strip comments with lex ]

You don't have to worry about stealing his thunder.  Try your lex thing
on this line:

        printf( "A comment starts with /* and ends with */\n" );


     
--
Tim Smith       sdcrdcf!ism780c!tim || ima!ism780!tim || ihnp4!cithep!tim