LLgen.amk 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # LLgen: LL(1) parser generator
  2. # variables: LLGEN, LLFLAGS
  3. # tool definition for the new version of LLgen that allows for more than
  4. # one parser in one program. Unfortunately, for historical reasons there
  5. # is no proper default prefix for LLgen-generated files (LL.output versus
  6. # Lpars.[ch]). If LLgen would generate LLpars.[ch] instead of Lpars.[ch],
  7. # we could have a default value for prefix of 'LL', which would make
  8. # things a bit more simple.
  9. %instance deftypesuffix(LLgen-src, '%.g') ;
  10. %include ack-defs.amk;
  11. %if (%not defined(LLGEN), {
  12. LLGEN = $EMHOME/bin/LLgen;
  13. });
  14. %if (%not defined(LLFLAGS), {
  15. LLFLAGS = {};
  16. });
  17. %tool LLgen (
  18. verbose: %boolean => %false;
  19. flags: %string %list => $LLFLAGS;
  20. prefix: %string => '';
  21. src: %in %list [type = LLgen-src];
  22. parser: %out %list [type = C-src]
  23. => match($src) + if($prefix == '', Lpars.c, $prefix'pars.c');
  24. tokens: %out [type = C-incl, compare]
  25. => if($prefix == '', Lpars.h, $prefix'pars.h');
  26. diagn: %out [type = text]
  27. => if($prefix == '', LL.output, $prefix.output) %conform $verbose;
  28. cmd: %in [type = command] => $LLGEN;
  29. )
  30. {
  31. exec($cmd, args => if($verbose, {'-vvv'}, {}) + $flags + $src);
  32. echo({'LLgen ', $src, ' done'});
  33. };