cleaned up a bit
This commit is contained in:
		
							parent
							
								
									6ee3538d91
								
							
						
					
					
						commit
						7f0b775587
					
				
					 4 changed files with 4 additions and 55 deletions
				
			
		|  | @ -9,9 +9,7 @@ OFILES = pars.o Lpars.o scan.o mylex.o default.o C_instr2.o help.o eval.o\ | ||||||
| 	 action.o | 	 action.o | ||||||
| IFILES = -I$(EM)/h -I$(EM)/modules/h | IFILES = -I$(EM)/h -I$(EM)/modules/h | ||||||
| CC = cc | CC = cc | ||||||
| 
 | CFLAGS = $(IFILES) | ||||||
| .c.o : |  | ||||||
| 	$(CC) $(IFILES) -c $< |  | ||||||
| 
 | 
 | ||||||
| all : dummy $(OFILES) | all : dummy $(OFILES) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ char **as_instructions;	    /* The buffer(?) where the instructions are saved */ | ||||||
| int quantum = 0,	    /* Max. nr. of instructions in as_instructions[] */ | int quantum = 0,	    /* Max. nr. of instructions in as_instructions[] */ | ||||||
|     nr_instr,		    /* Number of saved instructions */ |     nr_instr,		    /* Number of saved instructions */ | ||||||
|     first_action,	    /* Is this block of assembler-instr. the first after
 |     first_action,	    /* Is this block of assembler-instr. the first after
 | ||||||
| 			     * a '==>' or '::=' ? | 			     * a '==>'? | ||||||
| 			     */ | 			     */ | ||||||
|     last_action;	    /* Is this block followed by a '.' ? */ |     last_action;	    /* Is this block followed by a '.' ? */ | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -9,7 +9,6 @@ | ||||||
|  *	DEF_C_INSTR 	- 'C_loe..', 'C_ste..', '..icon, '..fcon', etc |  *	DEF_C_INSTR 	- 'C_loe..', 'C_ste..', '..icon, '..fcon', etc | ||||||
|  *	CONDITION 	- C-expression, for example: '$1 == 481' |  *	CONDITION 	- C-expression, for example: '$1 == 481' | ||||||
|  *	ARROW 		- '==>' |  *	ARROW 		- '==>' | ||||||
|  *	EQUIV 		- '::=' |  | ||||||
|  *	CALL 		- C-style functioncall, for example: 'error( 17)' |  *	CALL 		- C-style functioncall, for example: 'error( 17)' | ||||||
|  *	ASSEM_INSTR 	- C-style string, for example: '"mov r0, (r1)"' |  *	ASSEM_INSTR 	- C-style string, for example: '"mov r0, (r1)"' | ||||||
|  *	DEFAULT 	- 'default' |  *	DEFAULT 	- 'default' | ||||||
|  | @ -82,13 +81,6 @@ int mylex() | ||||||
| 		     } | 		     } | ||||||
| 		     break; | 		     break; | ||||||
| 
 | 
 | ||||||
| 	  case ':' : if ( equiv()) { |  | ||||||
| 			CD_pos = FALSE; |  | ||||||
| 			CALL_pos = TRUE; |  | ||||||
| 			return( EQUIV); |  | ||||||
| 		     } |  | ||||||
| 		     break; |  | ||||||
| 
 |  | ||||||
| 	  case 'd' : if ( CD_pos && _default()) { | 	  case 'd' : if ( CD_pos && _default()) { | ||||||
| 			CD_pos = FALSE; | 			CD_pos = FALSE; | ||||||
| 			special = FALSE; | 			special = FALSE; | ||||||
|  | @ -194,18 +186,6 @@ int arrow() /* '==>' */ | ||||||
| 	return( FALSE); | 	return( FALSE); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int equiv() /* '::=' */ |  | ||||||
| { |  | ||||||
| 	if ( ( *next++ = scanc()) == ':') |  | ||||||
| 		if ( ( *next++ = scanc()) == '=') |  | ||||||
| 			return( TRUE); |  | ||||||
| 		else |  | ||||||
| 			backc( *--next); |  | ||||||
| 	else |  | ||||||
| 		backc( *--next); |  | ||||||
| 	return( FALSE); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int _default() /* 'default' */ | int _default() /* 'default' */ | ||||||
| { | { | ||||||
| 	char c, skip_space(); | 	char c, skip_space(); | ||||||
|  | @ -266,7 +246,7 @@ read_call() | ||||||
| 
 | 
 | ||||||
| read_condition() | read_condition() | ||||||
| 
 | 
 | ||||||
| /* A CONDITION is followed by either '==>' or '::='.
 | /* A CONDITION is followed by '==>'
 | ||||||
|  */ |  */ | ||||||
| { | { | ||||||
| 	while ( TRUE) { | 	while ( TRUE) { | ||||||
|  | @ -281,15 +261,6 @@ read_condition() | ||||||
| 				return; | 				return; | ||||||
| 			     } | 			     } | ||||||
| 			     break; | 			     break; | ||||||
| 
 |  | ||||||
| 		  case ':' : if ( equiv()) { |  | ||||||
| 				backc( '='); |  | ||||||
| 				backc( ':'); |  | ||||||
| 				backc( ':'); |  | ||||||
| 				next -= 3; |  | ||||||
| 				return; |  | ||||||
| 			     } |  | ||||||
| 			     break; |  | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -299,12 +270,6 @@ char *str; | ||||||
| { | { | ||||||
| 	if ( *str == 'C' && *(str+1) == '_')	/* C_xxx */ | 	if ( *str == 'C' && *(str+1) == '_')	/* C_xxx */ | ||||||
| 		return( TRUE); | 		return( TRUE); | ||||||
| 	else if ( strncmp( "locals", str, 6) == 0) |  | ||||||
| 		return( TRUE); |  | ||||||
| 	else if ( strncmp( "jump", str, 4) == 0) |  | ||||||
| 		return( TRUE); |  | ||||||
| 	else if ( strncmp( "prolog", str, 6) == 0) |  | ||||||
| 		return( TRUE); |  | ||||||
| 	else | 	else | ||||||
| 		return( FALSE); | 		return( FALSE); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -44,7 +44,7 @@ char *to_change; | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| %token 	C_INSTR, DEF_C_INSTR, CONDITION, ARROW, EQUIV, | %token 	C_INSTR, DEF_C_INSTR, CONDITION, ARROW, | ||||||
| 	CALL, ASSEM_INSTR, DEFAULT, ERROR; | 	CALL, ASSEM_INSTR, DEFAULT, ERROR; | ||||||
| %start	table, table; | %start	table, table; | ||||||
| %start	def_row, def_row; | %start	def_row, def_row; | ||||||
|  | @ -79,13 +79,6 @@ simple	: ARROW 		{ save_output();} | ||||||
| 	  actionlist		{ back_patch();} | 	  actionlist		{ back_patch();} | ||||||
|         ; |         ; | ||||||
| 
 | 
 | ||||||
| /* |  | ||||||
| 	| EQUIV			{ no_conversions = TRUE; save_output();} |  | ||||||
| 	  actionlist		{ no_conversions = FALSE; back_patch();} |  | ||||||
| 
 |  | ||||||
| 	; |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| actionlist :			{ first_action = TRUE;} | actionlist :			{ first_action = TRUE;} | ||||||
| 	[ action		{ first_action = FALSE;} | 	[ action		{ first_action = FALSE;} | ||||||
|  | @ -131,9 +124,6 @@ Dspecial: CONDITION 		{ out( " %s ", yytext);} | ||||||
| Dsimple	: ARROW 		{ out( "%s", yytext);} | Dsimple	: ARROW 		{ out( "%s", yytext);} | ||||||
| 	  Dactionlist | 	  Dactionlist | ||||||
| 
 | 
 | ||||||
| 	| EQUIV			{ out( "%s", yytext);} |  | ||||||
| 	  Dactionlist		 |  | ||||||
| 
 |  | ||||||
| 	; | 	; | ||||||
| 
 | 
 | ||||||
| Dactionlist :  | Dactionlist :  | ||||||
|  | @ -196,8 +186,6 @@ c_special : CONDITION | ||||||
| c_simple: ARROW | c_simple: ARROW | ||||||
| 	  c_actionlist | 	  c_actionlist | ||||||
| 
 | 
 | ||||||
| 	| EQUIV |  | ||||||
| 	  c_actionlist |  | ||||||
| 	; | 	; | ||||||
| 
 | 
 | ||||||
| c_actionlist :  | c_actionlist :  | ||||||
|  | @ -254,8 +242,6 @@ int token; | ||||||
| 			  break; | 			  break; | ||||||
| 	  case ARROW	: fprint( STDERR,  "==> "); | 	  case ARROW	: fprint( STDERR,  "==> "); | ||||||
| 			  break; | 			  break; | ||||||
| 	  case EQUIV	: fprint( STDERR,  "::= "); |  | ||||||
| 			  break; |  | ||||||
| 	  case CONDITION: fprint( STDERR,  "CONDITION  %s", yytext); | 	  case CONDITION: fprint( STDERR,  "CONDITION  %s", yytext); | ||||||
| 			  break; | 			  break; | ||||||
| 	  case DEFAULT	: fprint( STDERR,  "default "); | 	  case DEFAULT	: fprint( STDERR,  "default "); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue