39 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| # LLgen:	LL(1) parser generator
 | |
| # variables:	LLGEN, LLFLAGS
 | |
| 
 | |
| # tool definition for the new version of LLgen that allows for more than
 | |
| # one parser in one program. Unfortunately, for historical reasons there
 | |
| # is no proper default prefix for LLgen-generated files (LL.output versus
 | |
| # Lpars.[ch]). If LLgen would generate LLpars.[ch] instead of Lpars.[ch],
 | |
| # we could have a default value for prefix of 'LL', which would make
 | |
| # things a bit more simple.
 | |
| 
 | |
| %instance deftypesuffix(LLgen-src, '%.g') ;
 | |
| 
 | |
| %include ack-defs.amk;
 | |
| 
 | |
| %if (%not defined(LLGEN), {
 | |
|     LLGEN = $EMHOME/bin/LLgen;
 | |
| });
 | |
| 
 | |
| %if (%not defined(LLFLAGS), {
 | |
|     LLFLAGS = {};
 | |
| });
 | |
| 
 | |
| %tool LLgen (
 | |
|     verbose: %boolean			  => %false;
 | |
|     flags:   %string %list		  => $LLFLAGS;
 | |
|     prefix:  %string			  => '';
 | |
|     src:     %in %list  [type = LLgen-src];
 | |
|     parser:  %out %list [type = C-src]
 | |
| 	=> match($src) + if($prefix == '', Lpars.c, $prefix'pars.c');
 | |
|     tokens:  %out      [type = C-incl, compare]
 | |
| 	=> if($prefix == '', Lpars.h, $prefix'pars.h');
 | |
|     diagn:   %out      [type = text]
 | |
| 	=> if($prefix == '', LL.output, $prefix.output) %conform $verbose;
 | |
|     cmd:     %in      [type = command]    => $LLGEN;
 | |
| )
 | |
| {
 | |
|     exec($cmd, args => if($verbose, {'-vvv'}, {}) + $flags + $src);
 | |
|     echo({'LLgen ', $src, ' done'});
 | |
| };
 |