Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
3.3 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  4. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  5. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  6. // PARTICULAR PURPOSE.
  7. //
  8. // Copyright (c) 2001 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------
  11. Description
  12. ===========
  13. Kbyacc is a modified version of the Berkeley YACC. All the modified portion
  14. are surrounded by #ifdef, #endif.
  15. User's Guide
  16. ============
  17. Skeleton.c contains the skeleton of the parser class (YYPARSER). YYPARSER derives from
  18. a custom base class. There are references in the skeleton to XGrowable for stack allocation
  19. which is our own custom allocator. This allocator defaults to an initial in-instance
  20. allocation and if that is insufficient growth is through a separate heap object. This
  21. allocator also features auto memory cleanup at the destructor.
  22. Usage
  23. =====
  24. usage: KBYacc.exe [-f sql/triplish] [-dlrtv] [-b file_prefix] [-p symbol_prefix]
  25. [-c baseclass <args>] filename
  26. -f flag is a custom flag for our own 2 different parsers, default is sql parser. The
  27. skeleton for the triplish parser is slightly different from the sql parser.
  28. -d flag specifies the name of the define file (the default name is y.tab.h)
  29. -l please refer to the document NEW_FEATURES
  30. -r please refer to the document NEW_FEATURES
  31. -t please refer to the document NEW_FEATURES
  32. -v Verbose mode
  33. -b [file_prefix] - file_prefix specifies the prefix of the output files. Default
  34. value is "y"
  35. -p [symbol_prefix] - symbol_prefix specifies the value of YYPREFIX, which is used as
  36. prefix for all the parser variables, i.e. the value stack, etc.
  37. Default value is "yy"
  38. -c [baseclass <args>] - The parser class(YYPARSER) inheritates from this base class that
  39. you can customize. <args> is the argument list of the constructor
  40. to the base class.
  41. [filename] - name of the input file
  42. Makefile.inc
  43. ============
  44. The following is fragment from a sample makefile.inc
  45. trparse.cxx parser.h: parser.y
  46. kbyacc -f triplish -d -l -b parser -p trip -c CTripYYBase "(IColumnMapper & ColumnMapper, LCID & locale, YYLEXER & yylex)" parser.y
  47. attrib -r trparse.cxx 2>nul
  48. attrib -r parser.h 2>nul
  49. -del trparse.cxx
  50. -del parser.h
  51. -ren parser.tab.c trparse.cxx
  52. -ren parser.tab.h parser.h
  53. parser.y is the grammar input file. parser.tab.h and parser.tab.c are the header and
  54. the implementation files genearted. This fragment shows that trparser.cxx and parser.h are
  55. depedent of parser.y. kbyacc is called with input file parser.y with base class CTripYYBase,
  56. The parameter list for the construtor is
  57. "(IColumnMapper & ColumnMapper, LCID & locale, YYLEXER & yylex)". parser.tab.c and
  58. parser.tab.h are then renamed to trparser.cxx and parser.h respectively.
  59. Skeleton files
  60. ==============
  61. The Header1, Header2, Header3 arrays contain the code for the header file generated.
  62. The Body and Trailer arrays contain the code for the implementation of yyparser.
  63. Bugs fixed
  64. ==========
  65. An array out of bound access bug to the check array is fixed in output.c