version 1.3, 1997/07/25 22:00:47 |
version 1.4, 2001/01/08 07:14:42 |
|
|
/* $OpenBSD$ */ |
/* $OpenBSD$ */ |
|
|
/* |
/* |
* Copyright (c) 1985 Sun Microsystems, Inc. |
* Copyright (c) 1980, 1993 |
* Copyright (c) 1980 The Regents of the University of California. |
* The Regents of the University of California. |
* Copyright (c) 1976 Board of Trustees of the University of Illinois. |
* Copyright (c) 1976 Board of Trustees of the University of Illinois. |
|
* Copyright (c) 1985 Sun Microsystems, Inc. |
* All rights reserved. |
* All rights reserved. |
* |
* |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
|
|
*/ |
*/ |
|
|
#ifndef lint |
#ifndef lint |
/*static char sccsid[] = "from: @(#)parse.c 5.12 (Berkeley) 2/26/91";*/ |
/*static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/6/93";*/ |
static char rcsid[] = "$OpenBSD$"; |
static char rcsid[] = "$OpenBSD$"; |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
|
|
|
|
/* |
/* |
* NAME: reduce |
* NAME: reduce |
* |
* |
* FUNCTION: Implements the reduce part of the parsing algorithm |
* FUNCTION: Implements the reduce part of the parsing algorithm |
* |
* |
* ALGORITHM: The following reductions are done. Reductions are repeated |
* ALGORITHM: The following reductions are done. Reductions are repeated |
* until no more are possible. |
* until no more are possible. |
* |
* |
* Old TOS New TOS |
* Old TOS New TOS |
* <stmt> <stmt> <stmtl> |
* <stmt> <stmt> <stmtl> |
* <stmtl> <stmt> <stmtl> |
* <stmtl> <stmt> <stmtl> |
|
|
* for <stmt> <stmt> |
* for <stmt> <stmt> |
* while <stmt> <stmt> |
* while <stmt> <stmt> |
* "dostmt" while <stmt> |
* "dostmt" while <stmt> |
* |
* |
* On each reduction, ps.i_l_follow (the indentation for the following line) |
* On each reduction, ps.i_l_follow (the indentation for the following line) |
* is set to the indentation level associated with the old TOS. |
* is set to the indentation level associated with the old TOS. |
* |
* |
* PARAMETERS: None |
* PARAMETERS: None |
* |
* |
* RETURNS: Nothing |
* RETURNS: Nothing |
* |
* |
* GLOBALS: ps.cstk ps.i_l_follow = ps.il ps.p_stack = ps.tos = |
* GLOBALS: ps.cstk ps.i_l_follow = ps.il ps.p_stack = ps.tos = |
* |
* |
* CALLS: None |
* CALLS: None |
* |
* |
* CALLED BY: parse |
* CALLED BY: parse |
* |
* |
* HISTORY: initial coding November 1976 D A Willcox of CAC |
* HISTORY: initial coding November 1976 D A Willcox of CAC |
* |
* |
*/ |
*/ |
/*----------------------------------------------*\ |
/*----------------------------------------------*\ |
| REDUCTION PHASE | |
| REDUCTION PHASE | |