I N T E R R U P T A B L E T R A N S I T I O N N E T W O R K S S e r g e i N i r e n b u r g
C o l g a t e U n i v e r s i t y C h a g i t A t t i y a
H e b r e w U n i v e r s i t y of J e r u s a l e m
A B S T R A C T
A s p e c i a l i z e d t r a n s i t i o n n e t w o r k m e c h a n i s m , t h e i n t e r r u p t a b l e t r a n s i t i o n n e t w o r k (ITN) is u s e d to p e r f o r m t h e last of t h r e e s t a g e s in a m u l t i p r o c e s s o r s y n t a c t i c p a r s e r . T h i s a p p r o a c h c a n be s e e n as an e x e r c i s e in i m p l e m e n t i n g a p a r s i n g p r o c e d u r e of t h e a c t i v e c h a r t p a r s e r family.
M o s t of t h e A T N p a r s e r
i m p l e m e n t a t i o n s u s e t h e l e f t - t o - r i g h t t o p - d o w n c h r o n o l o g i c a l b a c k t r a c k i n g c o n t r o l s t r u c t u r e (cf. Bates, 1978 for d i s c u s s i o n ) . T h e c o n t r o l s t r a t e g i e s of t h e a c t i v e c h a r t t y p e p e r m i t a b l e n d of b o t t o m - u p and t o p - d o w n p a r s i n g at t h e e x p e n s e of t i m e a n d s p a c e o v e r h e a d (cf. K a p l a n , 1973). T h e e n v i r o n m e n t in w h i c h the i n t e r r u p t a b l e t r a n s i t i o n n e t w o r k (ITN) has b e e n i m p l e m e n t e d is n o t s i m i l a r to 6 h a t of a t y p i c a l A T N m o d e l . N o r is it a s t r a i g h t f o r w a r d i m p l e m e n t a t i o n of an a c t i v e chart. ITN is r e s p o n s i b l e for o n e s t a g e in a m u l t i p r o c e s s o r p a r s i n g t e c h n i q u e d e s c r i b e d in L o z i n s k i i & N i r e n b u r g , ( 1 9 8 2 a and b), w h e r e p a r s i n g is p e r f o r m e d in e s s e n t i a l l y t h e b o t t o m - u p f a s h i o n in p a r a l l e l b y a set of r e l a t i v e l y s m a l l and "dumb" p r o c e s s i n g u n i t s r u n n i n g i d e n t i c a l s o f t w a r e . T h e p r o c e s s i n v o l v e s t h r e e stages: (a) p r o d u c i n g t h e c a n d i d a t e s t r i n g s of p r e t e r m i n a l c a t e g o r y s y m b o l s ; (b) d e t e r m i n i n g t h e p o s i t i o n s in t h i s s t r i n g at w h i c h h i g h e r - l e v e l c o n s t i t u e n t s s t a r t a n d (c) d e t e r m i n i n g t h e c l o s i n g b o u n d a r i e s of t h e s e c o n s t i t u e n t s .
E a c h of t h e p r o c e s s o r s a l l o c a t e d to t h e f i r s t s t a g e o b t a i n s t h e set of all s y n t a c t i c r e a d i n g s of o n e w o r d in t h e input string. U s i n g a t a b l e g r a m m a r , t h e p r o c e s s o r s t h e n c h o o s e a s u b s e t of the w o r d ' s r e a d i n g s t o e n s u r e c o m p a t i b i l i t y w i t h s i m i l a r s u b s e t s g e n e r a t e d by t h i s p r o c e s s o r ' s r i g h t a n d left n e i g h b o r .
S t a g e 2 u s e s t h e r e s u l t s of s t a g e 1 and a d i f f e r e n t t a b u l a r g r a m m a r to e s t a b l i s h t h e left ( " o p e n i n g " ) b o u n d a r i e s for c o m p o s i t e s e n t e n c e c o n s t i t u e n t s , s u c h as N P or PP. T h e o u t p u t of t h i s s t a g e a s s u m e s t h e f o r m of a s t r i n g of t r i a d s
l l a b e l x M), w h e r e l a h ~ l b e l o n g s to t h e v o c a b u l a r y of c o n s t i t u e n t types. In our i m p l e m e n t a t i o n this set i n c l u d e s S, NP, VP, PP, NP& (the " v i r t u a l " NP), D e l (the d e l i m i t e r ) , etc. X and M are the left and t h e r i g h t indices of t h e b o u n d a r i e s of t h e s e c o n s t i t u e n t s in the input s t r i n g . T h e y m a r k t h e p o i n t s at w h i c h p a r e n t h e s e s a r e t o b e o p e n e d (x) and c l o s e d (y) in t h e t r e e r e p r e s e n t a t i o n . T h e v a l u e s x a n d y r e l a t e t o p o s i t i o n s of w o r d s in t h e i n i t i a l input s t r i n g . For e x a m p l e , t h e s e n t e n c e (i) w i l l be p r o c e s s e d at s t a g e 2 into t h e s t r i n g (2). T h e '?' in (2) s t a n d for u n k n o w n c o o r d i n a t e s y.
(i) T h e v e r y b i g b r i c k b u i l d i n g t h a t sits
1 2 3 4 5 6 7
o n t h e h i l l b e l o n g s to t h e u n i v e r s i t y .
8 9 i0 ii 12 13 14
(2) (s 1 ? ) ( n p 1 ?)(s 6 ? ) ( n p & 6 6) (vp 7 ? ) ( p p 8 ? ) ( n p 9 ?)(vp ii ?) (pp 12 ? ) ( n p 13 ?)
It is at t h i s p o i n t t h a t t h e i n t e r r u p t a b l e t r a n s i t i o n n e t w o r k s t a r t s its w o r k of f i n d i n g t h e u n k n o w n b o u n d a r y c o o r d i n a t e s and t h u s d e t e r m i n i n g t h e u p p e r l e v e l s of t h e p a r s e tree.
after e a c h " l a y o u t " are r e t u r n e d to the s y s t e m p o o l of a v a i l a b l e r e s o u r c e s . At the t o p level in the p y r a m L d o n l y o n e p r o c e s s o r w L ] l remain. T h e s t a t u s of s u c h a p r o c e s s o r is d e c l a r e d final, and this t r l g g e r s the w r a p - u p o p e r a t i o n s and the c o n s t r u c t i o n of o u t p u t . T h e w r a p - u p u s e s the o r i g i n a l s t r i n g of w o r d s and the a p p r o p r i a t e s t r i n g of p r e t e r m i n a l s y m b o l s o b t a l n e d at s t a g e 1 t o g e t h e r w i t h t h e r e s u l t s of s t a g e 3 to b u i l d the p a r s e tree.
ITN can s t a r t p r o c e s s i n g at an a r b l t r a r y p o s i t i o n in the input string, not n e c e s s a r i l y at t h e b e g i n n i n g of a s e n t e n c e . T h e r e f o r e , w e i n t r o d u c e an a d d i t i o n a l s u b n e t w o r k , " i n i t i a l " , u s e d for h a n d l i n g c o n t r o l f l o w a m o n g t h e o t h e r s u b n e t w o r k s .
T h e llst of " c l o s e d " c o n s t i t u e n t s o b t a i n e d t h r o u g h I T N - b a s e d p a r s i n g of s t r i n g (2) c a n be f o u n d in (3), w h i l e (4)
is the o u t p u t of ITN p r o c e s s i n g of (3).
(3) (s 1 [4)(np 1 10)(s 6 1 0 ) ( n p & 6 6) (vp 7 1 0 ) ( p p 8 1 0 ) ( n p 9 1 0 ) ( v p ll 14) (pp 12 1 4 ) ( n p 13 14)
(4) ( s ( n p ( s ( n p & ) ( v p ( p p ( n p ) ) ) ) ) ( v p ( p p ) ) )
3. A n ITN I n t e r p r e t e r .
T h e i n t e r p r e t e r w a s d e s i g n e d for a p a r a l l e l p r o c e s s i n g system. T h i s g o a l c o m p e l l e d us to use a p r o g r a m e n v i r o n m e n t s o m e w h a t d i f f e r e n t f r o m t h e u s u a l p r a c t i c e of w r i t i n g A T N i n t e r p r e t e r s . Our i n t e r p r e t e r can, h o w e v e r , be u s e d to i n t e r p r e t b o t h ITNs and ATNs.
A n e w t y p e of arc w a s i n t r o d u c e d : the i n t e r r u p t arc INTR. T h e i n t e r r u p t arc
is a w a y o u t of a n e t w o r k s t a t e a d d i t i o n a l to t h e r e g u l a r POP. It g i v e s t h e p r o c e s s the o p p o r t u n i t y to r e s u m e f r o m t h e v e r y p o i n t w h e r e t h e i n t e r r u p t h a d b e e n called, but at a later s t a g e (this m e c h a n l s m is r a t h e r s i m i l a r to the d e t a c h - t y p e c o m m a n d s
in p r o g r a m m i n g l a n g u a g e s w h i c h s u p p o r t c o r o u t i n e s , s u c h as, for instance, S I M U L A ) . Thus, t h e i n t e r p r e t e r m u s t be a b l e to s u s p e n d p r o c e s s i n g a f t e r t r y i n g to p r o c e e d t h r o u g h a n y arc in a s t a t e and to r e s u m e p r o c e s s i n g later in t h a t v e r y state, f r o m t h e a r c i m m e d i a t e l y f o l l o w i n g the i n t e r r u p t arc. For e x a m p l e , if [NTR is the f o u r t h of s e v e n arcs in a state, the w o r k r e s u m e s f r o m the f i f t h arc in this state. T h i s is i m p l e m e n t e d w i t h a s t a c k in w h i c h t h e t r a n s i t i o n s in the net are r e c o r d e d . T h e P U S H and POP arcs are a l s o i m p l e m e n t e d t h r o u g h t h i s s t a c k and not t h r o u g h the r e c u r s i o n h a n d l i n g m e c h a n i s m s b u i l t into Lisp.
S i n c e it is n e v e r k n o w n to a n y p r o c e s s o r w h e t h e r it w i l l be a c t i v e at t h e n e x t stage, it is n e c e s s a r y t h a t t h e i n f o r m a t i o n it o b t a i n e d be s a v e d in a p l a c e w h e r e a n o t h e r p r o c e s s o r w i l l b e a b l e to f i n d it. U n l i k e t h e s t a n d a r d A T N p a r s e r s ( w h i c h r e t u r n t h e p a r s e t r e e as the v a l u e of t h e p a r s i n g f u n c t i o n ) , t h e I%N p a r s e r r e c o r d s t h e r e s u l t s in a s p e c i a l w o r k i n g a r e a (see d i s c u s s i o n b e l o w ) .
i m p l ~ m ~ n L a L i u n
T h e ITN i n t e r p r e t e r w a s i m p l e m e n t e d in YLISP, t h e d i a l e c t of L I S P d e v e l o p e d at t h e H e b r e w U n i v e r s i t y of J e r u s a l e m . A s p e c i a l s c h e d u l e r r o u t i n e for s i m u l a t i n g p a r a l l e l p r o c e s s e s on a V A X 1 1 / 7 8 0 w a s w r i t t e n by J a c o b Levy. T h e i n t e r p r e t e r a l s o u s e s t h e p y r a m i d p r o t o c o l p r o g r a m b y S h m u e l Bahr.
In w h a t f o l l o w s w e w i l l d e s c r i b e t h e o r g a n i z a t i o n of t h e stack, t h e w o r k i n g area, and t h e p r o g r a m itself.
a) T h e stack. T h e i t e m t o be s t a c k e d m u s t d e s c r i b e a p o s i t i o n in t h e n e t w o r k . A n item is p u s h e d o n t o t h e s t a c k e v e r y t i m e a P U S H or an INTR a r c is t r a v e r s e d . E v e r y t i m e a POP a r c is t r a v e r s e d or a r e t u r n f r o m an i n t e r r u p t o c c u r s o n e item is p o p p e d . T h e s t a c k item c o n s i s t s of: I) n a m e s and v a l u e s of t h e c u r r e n t n e t w o r k r e g i s t e r s ; 2) t h e r e m a i n d e r of t h e a r c s in t h e s t a t e (after t h e P U S H or t h e INTR t r a v e r s e d ) ; 3) t h e a c t i o n s of t h e P U S H arc t r a v e r s e d ; 4) t h e n a m e of t h e c u r r e n t n e t w o r k (i.e. t h a t of t h e l a t t e r ' s i n i t i a l s t a t e ) ; 5) t h e v a l u e of t h e input p o i n t e r (for t h e c a s e of a P U S H f a i l u r e ) .
T h e w o r k i n g a r e a is u s e d for t w o p u r p o s e s : to s u p p o r t m e s s a g e p a s s i n g b e t w e e n t h e p r o c e s s o r s a n d to h o l d t h e f i n d i n g s . T h e w o r k i n g a r e a is o r g a n i z e d as an array, R, t h a t h o l d s a d o u b l y linked list u s e d to c o n s t r u c t t h e o u t p u t tree. T h e a c t i o n s d e f i n e d on t h e w o r k i n g a r e a are: a) i n i t i a l i z a t i o n ( p r o c e d u r e i n i t - i n p u t ) : e v e r y c e l l R[i] in R o b t a i n s a t o k e n f r o m input, w h i l e t h e links R i l l . [ n e x t - i n d e x ] and R [ i ] . [ p r e v i o u s - i n d e x ] o b t a i n t h e v a l u e s i+l and i-l, r e s p e c t i v e l y ; b) CLOSE, the t o o l for d e l i m i t i n g s u b t r e e s in t h e input string;
T h e m a i n f u n c t i o n of t h e i n t e r p r e t e r i s c a l l e d //,El. It o b t a i n s t h e s t a c k c o n t a i n i n g t h e h i s t o r y of p r o c e s s i n g . If an i n t e r r u p t is e n c o u n t e r e d , t h e f u n c t i o n r e t u r n s t h e s t a c k w i t h n e w h i s t o r y , t o be
used
for i n v o k i n g t h i s f u n c t i o n again, b y t h e p y r a m i d p r o t o c o l .If a c a l l to i t n is a r e t u r n f r o m t h e i n t e r r u p t status, t h e n a s t a c k i t e m is p o p p e d (it c o r r e s p o n d s to t h e last s t a t e e n t e r e d d u r i n g t h e p r e v i o u s run). If t h e f u n c t i o n c a l l is t h e i n i t i a l one, w e s t a r t to s c a n t h e n e t w o r k f r o m t h e f i r s t s t a t e of t h e " i n i t i a l " s u b n e t w o r k .
A t t h i s s t a g e w e a l r e a d y k n o w w h i c h s t a t e of w h i c h n e t w o r k f r a g m e n t w e a r e in. M o r e o v e r , w e e v e n k n o w t h e p a t h t h r o u g h the s t a t e s and f r a g m e n t s w e t o o k in o r d e r to r e a c h t h i s s t a t e a n d t h e e x a c t a r c in this s t a t e f r o m w h i c h w e h a v e to s t a r t p r o c e s s i n g . So, w e e x e c u t e t h e t e s t on t h e c u r r e n t arc. If t h e t e s t s u c c e e d s w e p e r f o r m b r a n c h i n g on t h e a r c name.
T h e INTR a r c h a s t h e f o l l o w i n g s y n t a x : ( I N T R < d u m m y > < t e s t > < a c t i o n > * ) .
T h e c u r r e n t s t a t e is s t a c k e d and t h e p r o c e d u r e is e x i t e d r e t u r n i n g t h e s t a c k as t h e v a l u e . <dummy> w a s i n s e r t e d s i m p l y to p r e s e r v e t h e u s u a l c o n v e n t i o n of s i t u a t i n g t h e t e s t in t h e t h i r d s l o t in an arc.
T h e A B O R T a r c has t h e s y n t a x ( A B O R T < m e s s a g e > < t e s t > ) .
W h e n w e e n c o u n t e r a n e r r o r a n d it b e c o m e s c l e a r t h a t t h e input s t r i n g is illegal, w e w a n t to be a b l e to s t o p p r o c e s s i n g i m m e d i a t e l y and p r i n t a d i a g n o s t i c m e s s a g e .
T h e a c t i o n s on t h e s t a c k i n v o l v e t h e m o v e m e n t of an item to a n d f r o m t h e stack. T h e s t a c k item is t h e q u a n t u m v a l u e t h a t c a n be p u s h e d and p o p p e d , t h a t is n o p a r t of t h e i t e m is a c c e s s e d s e p a r a t e l y f r o m t h e r e s t of t h e v a l u e s in it. T h e f u n c t i o n s m a n a g i n g t h e s t a c k a r e p u s h - o n - s t a c k and p o p - f r o m - s t a c k .
T h e p u s h - o n - s t a c k is c a l l e d w h e n e v e r a P U S H or an INTR a r c is t r a v e r s e d . T h e p o p - f r o m - s t a c k is c a l l e d , first, w h e n t h e POP a r c is t r a v e r s e d and, second, w h e n t h e p r o c e s s r e s u m e s a f t e r r e t u r n f r o m an i n t e r r u p t .
T h e c l o s a a c t i o n is p e r f o r m e d w h e n w e find a b o u n d a r y for a c e r t a i n s u b t r e e for w h i c h t h e o p p o s i t e b o u n d a r y is a l r e a d y k n o w n (in our c a s e t h e b o u n d a r y t h a t is f o u n d is a l w a y s t h e r i g h t b o u n d a r y , y). Q I o ~ @ p e r f o r m s t w o t a s k s : first, it i n s e r t s t h e n u m e r i c v a l u e for y and, second, it d e c l a r e s t h e n e w l y b u i l t s u b t r e e a n e w t o k e n in t h e input s t r i n g .
For e x a m p l e , if t h e input s t r i n g had b e e n
<s 1 ?><np 1 ?><vp 4 ? > < n p 6 8 > < p p 9 i0>
1 2 3 4 5
a f t e r t h e a c t i o n ( c l o s e 3 i0) is p e r f o r m e d t h e input for f u r t h e r p r o c e s s i n g h a s t h e
form:
<s 1 ? > < n p i ? > < v p 4 I0>.
T h e p a r a m e t e r s of ~ l o s e a r e i) t h e n u m b e r of t h e t r i a d w e w a n t to c l o s e and 2) t h e v a l u e for w h i c h t h e y in t h i s t r i a d is t o be s u b s t i t u t e d . T h e d e f a u l t v a l u e for t h e s e c o n d p a r a m e t e r is t h e v a l u e of t h e y in t h e t r i a d c u r r e n t at t h e m o m e n t a c a l l t o ~ i o s ~ is made.
When t h e p r o c e s s i n g is p a r a l l e l , £ 1 o s ~ is a p p l i e d m u l t i p l y at e v e r y level, w h i c h w o u l d m e a n t h a t a h i g h e r l e v e l p r o c e s s o r w i l l o b t a i n p r e f a b r i c a t e d s u b t r e e s as e l e m e n t a r y input t o k e n s . T h i s is a m a j o r s o u r c e of t h e
efficiency
ofmultiprocessor
p a r s i n g .T h e ITN in t h e c u r r e n t i m p l e m e n t a t i o n i s r e l a t i v e l y small. A b r o a d e r i m p l e m e n t a t i o n w i l l be n e e d e d t o s t u d y t h e p r o p e r t i e s of t h i s p a r s i n g scheme,
i n c l u d i n g t h e e s t i m a t e s for its t i m e c o m p l e x i t y , and t h e e x t e n d a b i l i t y of t h e g r a m m a r . A c o m p a r i s o n s h o u l d a l s o be m a d e w i t h o t h e r m u l t i p r o c e s s o r p a r s i n g s c h e m e s , i n c l u d i n g t h o s e t h a t a r e b a s e d n o t on o r g a n i z i n g c o m m u n i c a t i o n a m o n g r e l a t i v e l y "dumb" p r o c e s s o r s r u n n i n g i d e n t i c a l s o f t w a r e b u t r a t h e r o n i n t e r a c t i o n of h i g h l y s p e c i a l i z e d a n d " i n t e l l i g e n t " p r o c e s s o r s -- cf., e.g., t h e w o r d e x p e r t p a r s e r (Small, 1981).
A c k n o w l e d g m e n t s . T h e a u t h o r s t h a n k E. L o z i n s k i i and Y. B e n A s h e r for t h e m a n y d i s c u s s i o n s of t h e ideas d e s c r i b e d in t h i s paper.
B i b l i o g r a p h y
Bates, M. (1978), T h e t h e o r y and p r a c t i c e of a u g m e n t e d t r a n s i t i o n n e t w o r k g r a m m a r s . In: L. B o l c (ed.), N a t u r a l L a n g u a g e C o m m u n i c a t i o n w i t h
Computers.
B e r l i n : S p r i n g e r .K a p l a n , R. M. (1973), A g e n e r a l s y n t a c t i c p r o c e s s o r . In R. R u s t i n (ed.), N a t u r a l L a n g u a g e P r o c e s s i n g . NY:
Academic
Press.L o z ~ n s k i i , E . L . a n d S. N l r e n b u r g
L o z i n s k i i , (1982b), language. France.
E . L . and S. N i r e n b u r g P a r a l l e l p r o c e s s i n g of n a t u r a l P r o c e e d i n g s of ECAI, Orsay,
Small, S. (1981), V i e w i n g w o r d e x p e r t p a r s i n g as a l i n g u i s t i c theory. P r o c e e d i n g s of IJCAI, V a n c o u v e r , B.C..
A p p e n d i x A. ITN: the m a i n f u n c t i o n of the i n t e r r u p t a b l e t r a n s i t i o n n e t w o r k
i n t e r p r e t e r (def Itn
( l a m b d a ( s t a c k )
; s t a c k - c u r r e n t p r o c e s s i n g s t a c k (prog (regs c u r r - s t a t e - a r c s n e t - n a m e
c u r t - a r c $ t e s t a r c - n a m e )
; regs - c u r r e n t r e g i s t e r s of t h e n e t w o r k ; c u r r - s t a t e - a r c s list of arcs not y e t ; p r o c e s s e d zn c u r r e n t s t a t e
; n e t - n a m e - n a m e of n e t w o r k b e i n g : p r o c e s s e d
; c u r t - a r c - arc in p r o c e s s i n g
;(all t h e s e are p u s h e d on s t a c k w h e n a ; 'push' arc o c c u r s )
; $ - a s p e c i a l r e g i s t e r .
; the f u n c t l o n f i r s t c h e c k s if s t a c k is ; nil; if not t h e n t h i s c a l l is a r e t u r n ; f r o m i n t e r r u p t p r e v i o u s v a l u e s m u s t be ; p o p p e d f r o m t h e s t a c k
[cond ( s t a c k (seta ec pn nil) ;set e n d - c h u n k flag to nil
( p o p - f r o m - s t a c k t)) (t ( s e t - n e t 'al] loop
[ c o n d ((null
curr-state-arcs)
( c o n d ( ( n u l l (pop nil)) ( r e t u r n nil)] (set ' c u r t - a r c (setcdr ' c u r t - s t a t e - a r c s ) ) ( set 'test (*nth c u r r - a r c 3) )
( c o n d ((eval test)
;test s u c c e e d s - t r a v e r s e t h e arc ( set ' a r c - n a m e (car c u r r - a r c ) ) [cond
((eq a r c - n a m e 'push ) ; P U S H ( e v l i s t (*nth c u r r - a r c 4)) ( p u s h - o n - s t a c k )
( s e t - n e t (cadr c u r r - a r c ) ) (go loop))
((eq a r c - n a m e 'pop ) ; POP ( e v l i s t ( * n t h c d r c u r r - a r c 3)) (cond
((null ( p o p ( e v a l ( c a d r c u r r - a r c ) ) ) ) ( r e t u r n $)))
(go loop))
((eq a r c - n a m e 'jump ) ; J U M P ( e v l i s t ( * n t h c d r c u r r - a r c 3)) ( s e t - s t a t e (*nth c u r t - a r c 2)) (go loop))
((eq a r c - n a m e 'to) ; TO (evlist ( * n t h c d r c u r r - a r c 3)) ( s e t - s t a t e (*nth c u r r - a r c 2)) (get-input)
(go loop))
((eq a r c - n a m e 'cat) ; C A T (cond L[eq ( c u r r l I ~ B ) )
(*nth c u r t - a r c 2)) ( e v l i s t
( * n t h c d r c u r r - a r c 3)))) (go loop))
((eq a r c - n a m e 'abort) ; A B O R T ( t p a t o m (*nth c u r r - a r c 2)) ( r e t u r n nil))
((eq a r c - n a m e 'intr) ; I N T e R r u p t ( p u s h - o n - s t a c k )
( r e t u r n stack))
(t ; e r r o r
( t p a t o m ' " i l l e g a l arc") ( r e t u r n nil))
( g o loop ] ; t r y n e x t a r c
A p p e n d ix B.
A F r a g m e n t of an ITN n e t w o r k
(the " i n i t i a l " a n d t h e s e n t e n c e s u b n e t w o r k s ) ;Note t h a t "jump" and "to" c a n b e e i t h e r ; t e r m i n a l a c t i o n s on an a r c or s e p a r a t e ;arcs
( d e f - n e t '(s-place) '( ( i n i t i a l
(pop t ( e n d - o f - s e n t ) (close*))
(intr nil ( e n d - o f - c h u n k ) ( ( t o i n i t i a l ) ) ) (push S (lab s)
((setr s - p l a c e ( i n p - p o i n t e r ) ) ) ( ( j u m p i n i t i a l / D E L ) ) )
(push NP (lab np) n i l ((to i n i t i a l ) ) ) (push VP (lab vp) n i l ((to i n i t i a l ) ) ) (push PP (lab pp) n i l ((to i n i t i a l ) ) ) (cat np& t (to initial))
(cat d e l t (to i n i t i a l ) ) ) ( i n i t i a l / D E L
(cat d e l t (close* (getr s - p l a c e ) ) (to initial)) (to i n i t i a l t]
( d e f - n e t '( v p - p l a c e n o - p p p p - p l a c e n p - p l a c e )
,(
(s
(pop t (is-def ( Y ) ) ( c l o s e ( i n p - p o i n t e r ) ) ) (to S/ t (setr n o - p p 0)))
(S/
(intr n i l ( e n d - o f - c h u n k ) ( ( t o S/))) (Bush PP (and (lab pp)
(le (getr n o - p p ) 2)) ((and (gt (getr n o - p p ) 0)
(close* (getr p p - p l a c e ) ) ) (setr p p - p l a c e ( i n p - p o i n t e r ) ) ) ((setr n o - p p (addl
(getr n o - p p ) ) ) (jump S/)))
( a b o r t " m o r e t h a n 2 PPs in S" (lab pp) ) (cat np& t (to S / N P & ) )
;(s (pp & pp) ..)
(cat d e l (gt (getr n o - p p ) 0) (close* p p - p l a c e ) (setr n o - p p l) (to S/))
(abort "DEL c a n n o t a p p e a r at
b e g i n n i n g of sent" (lab del)) (jump S / N P & t]
(S/NP&
(lab np) ((and
(getr pp-place)
(close* (getr pp-place))) (setr np-place (inp-pointer))) ((to S/NP)))
;here we can a l l o w PPs after an NP! (push VP
(lab vp)
((and (getr pp-place)
(close* (getr pp-place)))) ((jump S/OUT)))
(abort =no NP or VP in
the input sentence" t) (jump S/NP t]
(S/NP
(abort "not enough VPs in S" (end-of-sent))
(intr nil (end-of-chunk)((to S/NP))) (push VP (lab vp)
((setr vp-place (inp-pointer)) ;if there is a del
(close* (getr np-place))) ;close the preceding NP
;and everything in it ((jump S/VP)))
;(s .. (np & np) ..) (cat del (lab del)
(close" (getr np-place)) (to S/NP&))
(abort "too many NPs before a VP" (lab np]
(s/vP
(cat del (lab del)
(close* (getr vp-place))
(jump
S/VP/DEL))
(jump S/OUT t] (S/VP/DEL
;standing at 'del' and looking ahead (abort "del at EOS?"
(ge (next-one (inp-pointer)) sent-len))
; the above is a test for eos (intr nil (null (look-ahead i))
((lump S/VP/DEL)))
(to S/NP (eq
(look-ahead
l) 'vp))(jump S/OUT t] ;exit: it must be an s
(S/OUT