1: / builtins for shift-reduce parsking
   2: f = r5
   3: i = r3
   4: g = r4
   5: .globl succ,pbundle,goto,iget
   6: .globl g1
   7: .globl stack,unstack,gotab,accept
   8: 
   9: /stack label of present rule (state)
  10: /should come first in a rule
  11: 
  12: stack:
  13:         mov     i,(g)
  14:         sub     $2,(g)+
  15:         jmp     succ
  16: 
  17: /unstack(n) deletes last n stacked states
  18: /states are distinguishable from translations in not having
  19: /an exit bit ($1) nor being bundles ($100000)
  20: unstack:
  21:         jsr     pc,iget
  22:         mov     (r0),r0
  23:         mov     g,r1
  24: 1:
  25:         bit     -(r1),$100001
  26:         bne     1b
  27:         dec     r0
  28:         bge     1b
  29:         tst     (r1)+
  30:         br      1f
  31: 
  32: accept:                 /clean out all states from stack
  33:         mov     f,r1
  34:         add     $g1,r1
  35: 1:
  36:         mov     r1,r0
  37:         mov     r1,-(sp)
  38: 1:
  39:         cmp     r1,g
  40:         bge     2f
  41:         bit     (r1)+,$100001
  42:         beq     1b
  43:         mov     -2(r1),(r0)+
  44:         br      1b
  45: 2:
  46:         mov     r0,g
  47:         mov     (sp)+,r0
  48:         jsr     pc,pbundle
  49:         tst     r0
  50:         beq     1f
  51:         mov     r0,(g)+
  52: 1:
  53:         jmp     succ
  54: 
  55: /gotab(s1,t1,s2,t2,...sn,tn,0,t)
  56: /checks top of stack for states
  57: /s1,s2,... and goes to t1, t2 accordingly
  58: /if top of stack is not in table, goes to t
  59: 
  60: gotab:
  61:         mov     g,r0
  62: 1:
  63:         bit     -(r0),$100001   /find top state
  64:         bne     1b
  65:         mov     (r0),-(sp)
  66: 1:
  67:         jsr     pc,iget
  68:         tst     (r0)
  69:         beq     1f
  70:         cmp     (sp),r0
  71:         beq     1f
  72:         jsr     pc,iget
  73:         br      1b
  74: 1:
  75:         tst     (sp)+
  76:         jmp     goto

Defined functions

accept declared in line 7; defined in line 32; used 1 times
  • in line 7
f defined in line 2; used 1 times
  • in line 33
g defined in line 4; used 7 times
gotab declared in line 7; defined in line 60; used 1 times
  • in line 7
i defined in line 3; used 1 times
  • in line 13
stack declared in line 7; defined in line 12; used 1 times
  • in line 7
unstack declared in line 7; defined in line 20; used 1 times
  • in line 7
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 282
Valid CSS Valid XHTML 1.0 Strict