sl_gram.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
#include "sc.h"
#include "malloc.h"
#include "union.h"

Go to the source code of this file.

Data Structures

union  SL_STYPE
union  slx_alloc
 ! defined slx_overflow || SL_ERROR_VERBOSE More...

Defines

#define SL_BISON   1
 A Bison parser, made by GNU Bison 2.3.
#define SL_BISON_VERSION   "2.3"
 Bison version.
#define SL_SKELETON_NAME   "yacc.c"
 Skeleton name.
#define SL_PURE   0
 Pure parsers.
#define SL_LSP_NEEDED   0
 Using locations.
#define ACCFERM   1
 Tokens.
#define ACCOUVR   2
#define CONSTANTE   3
#define EGAL   4
#define IDENT   5
#define INF   6
#define INFEGAL   7
#define MOINS   8
#define PLUS   9
#define SUP   10
#define SUPEGAL   11
#define VAR   12
#define VIRG   13
#define OPINF   1
 ode des operateurs de comparaison
#define OPINFEGAL   2
#define OPEGAL   3
#define OPSUPEGAL   4
#define OPSUP   5
#define DROIT   1
#define GAUCHE   2
#define SL_DEBUG   0
 define NULL 0
#define SL_ERROR_VERBOSE   0
 Enabling verbose error messages.
#define SL_TOKEN_TABLE   0
 Enabling the token table.
#define slx_stype   SL_STYPE
#define SL_STYPE_IS_DECLARED   1
#define SL_STYPE_IS_TRIVIAL   1
#define SL_SIZE_T   unsigned int
#define SL_SIZE_MAXIMUM   ((SL_SIZE_T) -1)
#define SL__(msgid)   msgid
#define SL_USE(e)   ((void) (e))
 Suppress unused-variable warnings by "using" E.
#define SL_ID(n)   (n)
 Identity function, used to suppress warnings about constant conditions.
#define SL_STACK_ALLOC   SL_MALLOC
 The parser invokes alloca or malloc; define the necessary symbols.
#define SL_STACK_FREE   SL_FREE
#define SL_STACK_ALLOC_MAXIMUM   SL_SIZE_MAXIMUM
#define SL_MALLOC   malloc
#define SL_FREE   free
#define SL_STACK_GAP_MAXIMUM   (sizeof (union slx_alloc) - 1)
 The size of the maximum gap between one aligned stack and the next.
#define SL_STACK_BYTES(N)
 The size of an array large to enough to hold all stacks, each with N elements.
#define SL_COPY(To, From, Count)
 Copy COUNT objects from FROM to TO.
#define SL_STACK_RELOCATE(Stack)
 Relocate STACK from its old location to the new one.
#define SL_FINAL   3
 SL_FINAL -- State number of the termination state.
#define SL_LAST   31
 SL_LAST -- Last index in SL_TABLE.
#define SL_NTOKENS   16
 SL_NTOKENS -- Number of terminals.
#define SL_NNTS   25
 SL_NNTS -- Number of nonterminals.
#define SL_NRULES   40
 SL_NRULES -- Number of rules.
#define SL_NSTATES   49
 SL_NRULES -- Number of states.
#define SL_UNDEFTOK   2
 SL_TRANSLATE(SL_LEX) -- Bison symbol number corresponding to SL_LEX.
#define SL_MAXUTOK   257
#define SL_TRANSLATE(SL_X)   ((unsigned int) (SL_X) <= SL_MAXUTOK ? slx_translate[SL_X] : SL_UNDEFTOK)
#define SL_PACT_NINF   -25
 SL_PACT[STATE-NUM] -- Index in SL_TABLE of the portion describing STATE-NUM.
#define SL_TABLE_NINF   -40
 SL_TABLE[SL_PACT[STATE-NUM]].
#define slx_errok   (slx_errstatus = 0)
#define slx_clearin   (slx_char = SL_EMPTY)
#define SL_EMPTY   (-2)
#define SL_EOF   0
#define SL_ACCEPT   goto slx_acceptlab
#define SL_ABORT   goto slx_abortlab
#define SL_ERROR   goto slx_errorlab
#define SL_FAIL   goto slx_errlab
 Like SL_ERROR except do call slx_error.
#define SL_RECOVERING()   (!!slx_errstatus)
#define SL_BACKUP(Token, Value)
#define SL_TERROR   1
#define SL_ERRCODE   256
#define SL_RHSLOC(Rhs, K)   ((Rhs)[K])
 SL_LLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
#define SL_LLOC_DEFAULT(Current, Rhs, N)
#define SL__LOCATION_PRINT(File, Loc)   ((void) 0)
 SL__LOCATION_PRINT -- Print the location on the stream.
#define SL_LEX   slx_lex ()
 SL_LEX -- calling `slx_lex' with the right arguments.
#define SL_DPRINTF(Args)
 Enable debugging if requested.
#define SL__SYMBOL_PRINT(Title, Type, Value, Location)
#define SL__STACK_PRINT(Bottom, Top)
#define SL__REDUCE_PRINT(Rule)
#define SL_INITDEPTH   200
 !SL_DEBUG
#define SL_MAXDEPTH   10000
 SL_MAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used).
#define SL_POPSTACK(N)   (slx_vsp -= (N), slx_ssp -= (N))

Typedefs

typedef unsigned char slx_type_uint8
 Copy the second part of user declarations.
typedef short int slx_type_int8
typedef unsigned short int slx_type_uint16
typedef short int slx_type_int16

Enumerations

enum  slx_tokentype {
  ACCFERM = 1, ACCOUVR = 2, CONSTANTE = 3, EGAL = 4,
  IDENT = 5, INF = 6, INFEGAL = 7, MOINS = 8,
  PLUS = 9, SUP = 10, SUPEGAL = 11, VAR = 12,
  VIRG = 13, ACCFERM = 1, ACCOUVR = 2, CONSTANTE = 3,
  EGAL = 4, IDENT = 5, INF = 6, INFEGAL = 7,
  MOINS = 8, PLUS = 9, SUP = 10, SUPEGAL = 11,
  VAR = 12, VIRG = 13
}
 Tokens. More...

Functions

static void slx_destruct (char *slx_msg, int slx_type, SL_STYPE *slx_valuep) const
 SL_ERROR_VERBOSE.
int slx_parse ()
 Prevent warnings from -Wmissing-prototypes.
int slx_error (char *s)

Variables

char slx_text []
 Copy the first part of user declarations.
Psysteme ps_yacc
 dialogue avec l'analyseur lexical
boolean syntax_error
Value valcst
Value fac
int sens
 facteur multiplicatif suivant qu'on analyse un terme
short int cote
 indique le sens de l'inegalite sens = -1 ==> l'operateur est soit > ,soit >=, sens = 1 ==> l'operateur est soit <, soit <=
Value b1
 booleen indiquant quel membre est en cours d'analyse
Value b2
Pcontrainte eq
 element du vecteur colonne du systeme donne par l'analyse d'une contrainte
Pvecteur cp
 pointeur sur l'egalite ou l'inegalite courante
short int operat
 pointeur sur le membre courant
Pcontrainte p_eg_fin
 dernier operateur rencontre
Pcontrainte p_ineg_fin
 pointeur sur la derniere inegalite
Pvecteur p_pred
 pointeur sur le predecesseur du couple courant
Pvecteur p_membre_courant
Psyslist sl_yacc
Pbase ba_yacc = vect_add_variable(ba_yacc, (Variable) strdup(yytext))
Variable va_yacc
static const slx_type_uint8 slx_translate []
 SL_TRANSLATE[SL_LEX] -- Bison symbol number corresponding to SL_LEX.
static const slx_type_uint8 slx_r1 []
 SL_R1[SL_N] -- Symbol number of symbol that rule SL_N derives.
static const slx_type_uint8 slx_r2 []
 SL_R2[SL_N] -- Number of symbols composing right hand side of rule SL_N.
static const slx_type_uint8 slx_defact []
 SL_DEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when SL_TABLE doesn't specify something else to do.
static const slx_type_int8 slx_defgoto []
 SL_DEFGOTO[NTERM-NUM].
static const slx_type_int8 slx_pact []
static const slx_type_int8 slx_pgoto []
 SL_PGOTO[NTERM-NUM].
static const slx_type_int8 slx_table []
static const slx_type_uint8 slx_check []
static const slx_type_uint8 slx_stos []
 SL_STOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM.
int slx_char
 ! SL_PARSE_PARAM
SL_STYPE slx_lval
 The semantic value of the look-ahead symbol.
int slx_nerrs
 Number of syntax errors so far.


Define Documentation

#define ACCFERM   1

Tokens.

Definition at line 85 of file sl_gram.c.

#define ACCOUVR   2

Definition at line 86 of file sl_gram.c.

#define CONSTANTE   3

Definition at line 87 of file sl_gram.c.

#define DROIT   1

Definition at line 148 of file sl_gram.c.

#define EGAL   4

Definition at line 88 of file sl_gram.c.

#define GAUCHE   2

Definition at line 149 of file sl_gram.c.

#define IDENT   5

Definition at line 89 of file sl_gram.c.

#define INF   6

Definition at line 90 of file sl_gram.c.

#define INFEGAL   7

Definition at line 91 of file sl_gram.c.

#define MOINS   8

Definition at line 92 of file sl_gram.c.

#define OPEGAL   3

Definition at line 145 of file sl_gram.c.

#define OPINF   1

ode des operateurs de comparaison

Definition at line 143 of file sl_gram.c.

#define OPINFEGAL   2

Definition at line 144 of file sl_gram.c.

#define OPSUP   5

Definition at line 147 of file sl_gram.c.

#define OPSUPEGAL   4

Definition at line 146 of file sl_gram.c.

#define PLUS   9

Definition at line 93 of file sl_gram.c.

#define SL__ ( msgid   )     msgid

Definition at line 250 of file sl_gram.c.

Referenced by slx_parse().

#define SL__LOCATION_PRINT ( File,
Loc   )     ((void) 0)

SL__LOCATION_PRINT -- Print the location on the stream.

This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know.

Definition at line 688 of file sl_gram.c.

#define SL__REDUCE_PRINT ( Rule   ) 

Definition at line 858 of file sl_gram.c.

Referenced by slx_parse().

#define SL__STACK_PRINT ( Bottom,
Top   ) 

Definition at line 857 of file sl_gram.c.

Referenced by slx_parse().

#define SL__SYMBOL_PRINT ( Title,
Type,
Value,
Location   ) 

Definition at line 856 of file sl_gram.c.

Referenced by slx_destruct(), and slx_parse().

#define SL_ABORT   goto slx_abortlab

Definition at line 617 of file sl_gram.c.

Referenced by slx_parse().

#define SL_ACCEPT   goto slx_acceptlab

Definition at line 616 of file sl_gram.c.

Referenced by slx_parse().

#define SL_BACKUP ( Token,
Value   ) 

Value:

do                                                              \
  if (slx_char == SL_EMPTY && slx_len == 1)                             \
    {                                                           \
      slx_char = (Token);                                               \
      slx_lval = (Value);                                               \
      slx_token = SL_TRANSLATE (slx_char);                              \
      SL_POPSTACK (1);                                          \
      goto slx_backup;                                          \
    }                                                           \
  else                                                          \
    {                                                           \
      slx_error (SL__("syntax error: cannot back up")); \
      SL_ERROR;                                                 \
    }                                                           \
while (SL_ID (0))

Definition at line 629 of file sl_gram.c.

#define SL_BISON   1

A Bison parser, made by GNU Bison 2.3.

Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception.

This special exception was added by the Free Software Foundation in version 2.2 of Bison. C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. All symbols defined below should begin with slx_ or SL_, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. Identify Bison output.

Definition at line 47 of file sl_gram.c.

#define SL_BISON_VERSION   "2.3"

Bison version.

Definition at line 50 of file sl_gram.c.

#define SL_COPY ( To,
From,
Count   ) 

Value:

do                                      \
        {                                       \
          SL_SIZE_T slx_i;                              \
          for (slx_i = 0; slx_i < (Count); slx_i++)     \
            (To)[slx_i] = (From)[slx_i];                \
        }                                       \
      while (SL_ID (0))
Copy COUNT objects from FROM to TO.

The source and destination do not overlap.

Definition at line 376 of file sl_gram.c.

#define SL_DEBUG   0

define NULL 0

Enabling traces.

Definition at line 156 of file sl_gram.c.

#define SL_DPRINTF ( Args   ) 

Enable debugging if requested.

!SL_DEBUG

Definition at line 855 of file sl_gram.c.

Referenced by slx_parse().

#define SL_EMPTY   (-2)

Definition at line 613 of file sl_gram.c.

Referenced by slx_parse().

#define SL_EOF   0

Definition at line 614 of file sl_gram.c.

Referenced by slx_parse().

#define SL_ERRCODE   256

Definition at line 648 of file sl_gram.c.

#define SL_ERROR   goto slx_errorlab

Definition at line 618 of file sl_gram.c.

#define SL_ERROR_VERBOSE   0

Enabling verbose error messages.

Definition at line 164 of file sl_gram.c.

#define SL_FAIL   goto slx_errlab

Like SL_ERROR except do call slx_error.

This remains here temporarily to ease the transition to the new meaning of SL_ERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go.

Definition at line 625 of file sl_gram.c.

#define SL_FINAL   3

SL_FINAL -- State number of the termination state.

Definition at line 406 of file sl_gram.c.

Referenced by slx_parse().

#define SL_FREE   free

Definition at line 339 of file sl_gram.c.

#define SL_ID ( n   )     (n)

Identity function, used to suppress warnings about constant conditions.

Definition at line 263 of file sl_gram.c.

Referenced by slx_parse().

#define SL_INITDEPTH   200

!SL_DEBUG

SL_INITDEPTH -- initial size of the parser's stacks.

Definition at line 864 of file sl_gram.c.

Referenced by slx_parse().

#define SL_LAST   31

SL_LAST -- Last index in SL_TABLE.

Definition at line 408 of file sl_gram.c.

Referenced by slx_parse().

#define SL_LEX   slx_lex ()

SL_LEX -- calling `slx_lex' with the right arguments.

Definition at line 698 of file sl_gram.c.

Referenced by slx_parse().

#define SL_LLOC_DEFAULT ( Current,
Rhs,
 ) 

Value:

do                                                                      \
      if (SL_ID (N))                                                    \
        {                                                               \
          (Current).first_line   = SL_RHSLOC (Rhs, 1).first_line;       \
          (Current).first_column = SL_RHSLOC (Rhs, 1).first_column;     \
          (Current).last_line    = SL_RHSLOC (Rhs, N).last_line;                \
          (Current).last_column  = SL_RHSLOC (Rhs, N).last_column;      \
        }                                                               \
      else                                                              \
        {                                                               \
          (Current).first_line   = (Current).last_line   =              \
            SL_RHSLOC (Rhs, 0).last_line;                               \
          (Current).first_column = (Current).last_column =              \
            SL_RHSLOC (Rhs, 0).last_column;                             \
        }                                                               \
    while (SL_ID (0))

Definition at line 657 of file sl_gram.c.

#define SL_LSP_NEEDED   0

Using locations.

Definition at line 59 of file sl_gram.c.

#define SL_MALLOC   malloc

Definition at line 332 of file sl_gram.c.

#define SL_MAXDEPTH   10000

SL_MAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used).

Do not make this value too large; the results are undefined if SL_STACK_ALLOC_MAXIMUM < SL_STACK_BYTES (SL_MAXDEPTH) evaluated with infinite-precision integer arithmetic.

Definition at line 875 of file sl_gram.c.

Referenced by slx_parse().

#define SL_MAXUTOK   257

Definition at line 421 of file sl_gram.c.

#define SL_NNTS   25

SL_NNTS -- Number of nonterminals.

Definition at line 413 of file sl_gram.c.

#define SL_NRULES   40

SL_NRULES -- Number of rules.

Definition at line 415 of file sl_gram.c.

#define SL_NSTATES   49

SL_NRULES -- Number of states.

Definition at line 417 of file sl_gram.c.

#define SL_NTOKENS   16

SL_NTOKENS -- Number of terminals.

Definition at line 411 of file sl_gram.c.

Referenced by slx_parse().

#define SL_PACT_NINF   -25

SL_PACT[STATE-NUM] -- Index in SL_TABLE of the portion describing STATE-NUM.

Definition at line 561 of file sl_gram.c.

Referenced by slx_parse().

#define SL_POPSTACK (  )     (slx_vsp -= (N), slx_ssp -= (N))

Referenced by slx_parse().

#define SL_PURE   0

Pure parsers.

Definition at line 56 of file sl_gram.c.

 
#define SL_RECOVERING (  )     (!!slx_errstatus)

Definition at line 627 of file sl_gram.c.

#define SL_RHSLOC ( Rhs,
 )     ((Rhs)[K])

SL_LLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].

If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined).

Definition at line 655 of file sl_gram.c.

#define SL_SIZE_MAXIMUM   ((SL_SIZE_T) -1)

Definition at line 240 of file sl_gram.c.

#define SL_SIZE_T   unsigned int

Definition at line 236 of file sl_gram.c.

Referenced by slx_parse().

#define SL_SKELETON_NAME   "yacc.c"

Skeleton name.

Definition at line 53 of file sl_gram.c.

#define SL_STACK_ALLOC   SL_MALLOC

The parser invokes alloca or malloc; define the necessary symbols.

Definition at line 318 of file sl_gram.c.

Referenced by slx_parse().

#define SL_STACK_ALLOC_MAXIMUM   SL_SIZE_MAXIMUM

Definition at line 321 of file sl_gram.c.

Referenced by slx_parse().

#define SL_STACK_BYTES (  ) 

Value:

((N) * (sizeof (slx_type_int16) + sizeof (SL_STYPE)) \
      + SL_STACK_GAP_MAXIMUM)
The size of an array large to enough to hold all stacks, each with N elements.

Definition at line 365 of file sl_gram.c.

Referenced by slx_parse().

#define SL_STACK_FREE   SL_FREE

Definition at line 319 of file sl_gram.c.

Referenced by slx_parse().

#define SL_STACK_GAP_MAXIMUM   (sizeof (union slx_alloc) - 1)

The size of the maximum gap between one aligned stack and the next.

Definition at line 361 of file sl_gram.c.

#define SL_STACK_RELOCATE ( Stack   ) 

Value:

do                                                                      \
      {                                                                 \
        SL_SIZE_T slx_newbytes;                                         \
        SL_COPY (&slx_ptr->Stack, Stack, slx_size);                             \
        Stack = &slx_ptr->Stack;                                                \
        slx_newbytes = slx_stacksize * sizeof (*Stack) + SL_STACK_GAP_MAXIMUM; \
        slx_ptr += slx_newbytes / sizeof (*slx_ptr);                            \
      }                                                                 \
    while (SL_ID (0))
Relocate STACK from its old location to the new one.

The local variables SL_SIZE and SL_STACKSIZE give the old and new number of elements in the stack, and SL_PTR gives the new location of the stack. Advance SL_PTR to a properly aligned location for the next stack.

Definition at line 392 of file sl_gram.c.

Referenced by slx_parse().

#define SL_STYPE_IS_DECLARED   1

Definition at line 183 of file sl_gram.c.

#define SL_STYPE_IS_TRIVIAL   1

Definition at line 184 of file sl_gram.c.

#define SL_TABLE_NINF   -40

SL_TABLE[SL_PACT[STATE-NUM]].

What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what SL_DEFACT says. If SL_TABLE_NINF, syntax error.

Definition at line 583 of file sl_gram.c.

Referenced by slx_parse().

#define SL_TERROR   1

Definition at line 647 of file sl_gram.c.

Referenced by slx_parse().

#define SL_TOKEN_TABLE   0

Enabling the token table.

Definition at line 169 of file sl_gram.c.

#define SL_TRANSLATE ( SL_X   )     ((unsigned int) (SL_X) <= SL_MAXUTOK ? slx_translate[SL_X] : SL_UNDEFTOK)

Definition at line 423 of file sl_gram.c.

Referenced by slx_parse().

#define SL_UNDEFTOK   2

SL_TRANSLATE(SL_LEX) -- Bison symbol number corresponding to SL_LEX.

Definition at line 420 of file sl_gram.c.

#define SL_USE (  )     ((void) (e))

Suppress unused-variable warnings by "using" E.

Definition at line 256 of file sl_gram.c.

Referenced by slx_destruct().

#define slx_clearin   (slx_char = SL_EMPTY)

Definition at line 612 of file sl_gram.c.

#define slx_errok   (slx_errstatus = 0)

Definition at line 611 of file sl_gram.c.

#define slx_stype   SL_STYPE

Definition at line 182 of file sl_gram.c.

#define SUP   10

Definition at line 94 of file sl_gram.c.

#define SUPEGAL   11

Definition at line 95 of file sl_gram.c.

#define VAR   12

Definition at line 96 of file sl_gram.c.

#define VIRG   13

Definition at line 97 of file sl_gram.c.


Typedef Documentation

typedef short int slx_type_int16

Definition at line 223 of file sl_gram.c.

typedef short int slx_type_int8

Definition at line 211 of file sl_gram.c.

typedef unsigned short int slx_type_uint16

Definition at line 217 of file sl_gram.c.

typedef unsigned char slx_type_uint8

Copy the second part of user declarations.

Line 216 of yacc.c.

Definition at line 202 of file sl_gram.c.


Enumeration Type Documentation

Tokens.

Put the tokens into the symbol table, so that GDB and other debuggers know about them.

Enumerator:
ACCFERM 
ACCOUVR 
CONSTANTE 
EGAL 
IDENT 
INF 
INFEGAL 
MOINS 
PLUS 
SUP 
SUPEGAL 
VAR 
VIRG 
ACCFERM 
ACCOUVR 
CONSTANTE 
EGAL 
IDENT 
INF 
INFEGAL 
MOINS 
PLUS 
SUP 
SUPEGAL 
VAR 
VIRG 

Definition at line 68 of file sl_gram.c.

00068                       {
00069      ACCFERM = 1,
00070      ACCOUVR = 2,
00071      CONSTANTE = 3,
00072