Home | History | Annotate | Line # | Download | only in compiler
aslparser.y revision 1.1
      1 %{
      2 /******************************************************************************
      3  *
      4  * Module Name: aslparser.y - Master Bison/Yacc input file for iASL
      5  *
      6  *****************************************************************************/
      7 
      8 /*
      9  * Copyright (C) 2000 - 2014, Intel Corp.
     10  * All rights reserved.
     11  *
     12  * Redistribution and use in source and binary forms, with or without
     13  * modification, are permitted provided that the following conditions
     14  * are met:
     15  * 1. Redistributions of source code must retain the above copyright
     16  *    notice, this list of conditions, and the following disclaimer,
     17  *    without modification.
     18  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     19  *    substantially similar to the "NO WARRANTY" disclaimer below
     20  *    ("Disclaimer") and any redistribution must be conditioned upon
     21  *    including a substantially similar Disclaimer requirement for further
     22  *    binary redistribution.
     23  * 3. Neither the names of the above-listed copyright holders nor the names
     24  *    of any contributors may be used to endorse or promote products derived
     25  *    from this software without specific prior written permission.
     26  *
     27  * Alternatively, this software may be distributed under the terms of the
     28  * GNU General Public License ("GPL") version 2 as published by the Free
     29  * Software Foundation.
     30  *
     31  * NO WARRANTY
     32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     33  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     34  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     35  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     36  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     40  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     41  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     42  * POSSIBILITY OF SUCH DAMAGES.
     43  */
     44 
     45 #include "aslcompiler.h"
     46 #include "acpi.h"
     47 #include "accommon.h"
     48 
     49 #define _COMPONENT          ACPI_COMPILER
     50         ACPI_MODULE_NAME    ("aslparse")
     51 
     52 /*
     53  * Global Notes:
     54  *
     55  * October 2005: The following list terms have been optimized (from the
     56  * original ASL grammar in the ACPI specification) to force the immediate
     57  * reduction of each list item so that the parse stack use doesn't increase on
     58  * each list element and possibly overflow on very large lists (>4000 items).
     59  * This dramatically reduces use of the parse stack overall.
     60  *
     61  *      ArgList, TermList, Objectlist, ByteList, DWordList, PackageList,
     62  *      ResourceMacroList, and FieldUnitList
     63  */
     64 
     65 void *
     66 AslLocalAllocate (
     67     unsigned int            Size);
     68 
     69 /* Bison/yacc configuration */
     70 
     71 #define static
     72 #undef malloc
     73 #define malloc              AslLocalAllocate
     74 #undef alloca
     75 #define alloca              AslLocalAllocate
     76 #undef yytname
     77 #define yytname             AslCompilername
     78 
     79 #define YYINITDEPTH         600             /* State stack depth */
     80 #define YYDEBUG             1               /* Enable debug output */
     81 #define YYERROR_VERBOSE     1               /* Verbose error messages */
     82 #define YYFLAG              -32768
     83 
     84 /* Define YYMALLOC/YYFREE to prevent redefinition errors  */
     85 
     86 #define YYMALLOC            AslLocalAllocate
     87 #define YYFREE              ACPI_FREE
     88 %}
     89 
     90 /*
     91  * Declare the type of values in the grammar
     92  */
     93 %union {
     94     UINT64              i;
     95     char                *s;
     96     ACPI_PARSE_OBJECT   *n;
     97 }
     98 
     99 /*
    100  * These shift/reduce conflicts are expected. There should be zero
    101  * reduce/reduce conflicts.
    102  */
    103 %expect 86
    104 
    105 /*! [Begin] no source code translation */
    106 
    107 /*
    108  * The M4 macro processor is used to bring in the parser items,
    109  * in order to keep this master file smaller, and to break up
    110  * the various parser items.
    111  */
    112 m4_define(NoEcho)
    113 
    114 /* Token types */
    115 
    116 m4_include(asltokens.y)
    117 
    118 /* Production types/names */
    119 
    120 m4_include(asltypes.y)
    121 %%
    122 
    123 /* Production rules */
    124 
    125 m4_include(aslrules.y)
    126 %%
    127 
    128 /*! [End] no source code translation !*/
    129 
    130 /* Local support functions in C */
    131 
    132 m4_include(aslsupport.y)
    133