make_new_lang_lex 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/sh
  2. #####################################################-*-mode:shell-script-*-
  3. ## ##
  4. ## Language Technologies Institute ##
  5. ## Carnegie Mellon University ##
  6. ## Copyright (c) 2013 ##
  7. ## All Rights Reserved. ##
  8. ## ##
  9. ## Permission is hereby granted, free of charge, to use and distribute ##
  10. ## this software and its documentation without restriction, including ##
  11. ## without limitation the rights to use, copy, modify, merge, publish, ##
  12. ## distribute, sublicense, and/or sell copies of this work, and to ##
  13. ## permit persons to whom this work is furnished to do so, subject to ##
  14. ## the following conditions: ##
  15. ## 1. The code must retain the above copyright notice, this list of ##
  16. ## conditions and the following disclaimer. ##
  17. ## 2. Any modifications must be clearly marked as such. ##
  18. ## 3. Original authors' names are not deleted. ##
  19. ## 4. The authors' names are not used to endorse or promote products ##
  20. ## derived from this software without specific prior written ##
  21. ## permission. ##
  22. ## ##
  23. ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
  24. ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
  25. ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
  26. ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
  27. ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
  28. ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
  29. ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
  30. ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
  31. ## THIS SOFTWARE. ##
  32. ## ##
  33. ###########################################################################
  34. ## ##
  35. ## Make empty lang and lex directories for a new language ##
  36. ## ##
  37. ###########################################################################
  38. export LANG=C;
  39. if [ $# = 0 ]
  40. then
  41. echo ./tools/make_new_lang_lex LANGNAME
  42. echo Will make:
  43. echo lang/cmu_${LANGNAME}_lex/cmu_${LANGNAME}_lex.h
  44. echo lang/cmu_${LANGNAME}_lex/cmu_${LANGNAME}_lex.c
  45. echo lang/cmu_${LANGNAME}_lang/cmu_${LANGNAME}_lang.h
  46. echo lang/cmu_${LANGNAME}_lang/cmu_${LANGNAME}_lang.c
  47. echo You may want to use tools/build_lex to make a more complete
  48. echo set of files for lang/cmu_${LANGNAME}_lex/
  49. echo
  50. echo "Note this doesn't add anything to CVS, nor does it add the"
  51. echo "lang to the langlist (add them to config/default.lv) by hand"
  52. fi
  53. LANGNAME=$1
  54. mkdir lang/cmu_${LANGNAME}_lex
  55. cat tools/Makefile.lex |
  56. sed 's/LANGNAME/'${LANGNAME}'/g' >lang/cmu_${LANGNAME}_lex/Makefile
  57. cat tools/LANGNAME_lex.h |
  58. sed 's/LANGNAME/'${LANGNAME}'/g' >lang/cmu_${LANGNAME}_lex/cmu_${LANGNAME}_lex.h
  59. cat tools/LANGNAME_lex.c |
  60. sed 's/LANGNAME/'${LANGNAME}'/g' >lang/cmu_${LANGNAME}_lex/cmu_${LANGNAME}_lex.c
  61. echo made lang/cmu_${LANGNAME}_lex/ and skeleton files
  62. mkdir lang/cmu_${LANGNAME}_lang
  63. cat tools/Makefile.lang |
  64. sed 's/LANGNAME/'${LANGNAME}'/g' >lang/cmu_${LANGNAME}_lang/Makefile
  65. cat tools/LANGNAME_lang.h |
  66. sed 's/LANGNAME/'${LANGNAME}'/g' >lang/cmu_${LANGNAME}_lang/cmu_${LANGNAME}_lang.h
  67. cat tools/LANGNAME_lang.c |
  68. sed 's/LANGNAME/'${LANGNAME}'/g' >lang/cmu_${LANGNAME}_lang/cmu_${LANGNAME}_lang.c
  69. echo made lang/cmu_${LANGNAME}_lang/ and skeleton files