Trailing-Edge
-
PDP-10 Archives
-
decuslib20-02
-
decus/20-0028/syntax.lst
There is 1 other file named syntax.lst in the archive. Click here to see a list.
SNOBOL4 (VERSION 3.4.3, JAN. 16, 1971)
DIGITAL EQUIPMENT CORP., PDP-10
* This program is a syntatic recognizer for snobol4
* statements. The syntax used is for Version 3 with
* the PDP-10 graphics.
*
* L.P. Wade at TYMSHARE 5-9-70
1
* A series of patterns is built, culminating
* a pattern that matches SNOBOL4 statements.
2
3
* Card images are then read in and processed.
4
5 DEFINE('opt(pattern)')
6
7 OPSYN('^','opt',1)
8 OPSYN('%','SPAN',1)
9 OPSYN('@','ANY',1)
10 leftbr _ @'<['
11 rightbr _ @'>]'
12 lower _ 'abcdefghijklmnopqrstuvwxyz'
13 UPPER _ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
14 letters _ UPPER lower
15 digits _ '0123456789'
16 alphanumerics _ letters digits
17 blanks _ %' '
18 integer _ %digits
19 real _ integer '.' ^integer
20 identifier _ @letters ^%(alphanumerics '.')
21 opsyms _ '+-/*$%#@^\!'
22 unary _ @opsyms
23 binary _ unary ! '**'
24 binaryop _ blanks ^(binary blanks)
25 unqalpha _ &ALPHABET
26 unqalpha '"' _
27 unqalpha "'" _
28 dliteral _ '"' ^%(unqalpha "'") '"'
29 sliteral _ "'" ^%(unqalpha '"') "'"
30 literal _ sliteral ! dliteral ! integer ! real
31 element _ ^unary (identifier ! literal ! *function.call
31 + ! '(' *expression ')' ! *array.ref)
32 operation _ *element binaryop (*element
32 + ! *expression)
33 expression _ ^blanks (*element ! *operation
33 + ! null) ^blanks
34 arglist _ *expression ^(',' *arglist)
35 function.call _ identifier '(' *arglist ')'
36 array.ref _ identifier leftbr *arglist rightbr
37 label _ @alphanumerics (BREAK(' ;')
37 + ! REM)
38 label.field _ ^label
39 goto _ '(' expression ')' ! leftbr expression
39 + rightbr
40 goto.field _ ^(blanks ':'
40 + FENCE ^blanks (goto ! 'S' goto
40 + ! 'F' goto ! 'S' goto ^blanks 'F'
40 + goto ! 'F' goto ^blanks 'S' goto)
40 + ^blanks)
41 eql _ @'=_'
42 rule _ ^(blanks element (blanks eql ^(blanks
42 + expression) ! ^(blanks expression ^(blanks eql
42 + ^(blanks expression)) )))
43 eos _ RPOS(0) ! ';'
44 statement _ label.field rule goto.field eos
45
46
* The recognizing program follows. Comment and continue
* cards are not processed. If an erroneous statement
* is encountered in a string of statemtns separated by
* semicolons, subsequent statements in that string are
* not processed.
*
47
48 INPUT(.input,5,72)
49 &ANCHOR _ 1
50 &TRIM _ 1
51 &FULLSCAN _ 1
52 eof _
53 space _ DUPL(' ',5)
54 line _
55 comment _ @'*-'
56 continue _ @'+.' . cc
57 readi image _ input :F(END)
58 OUTPUT _ space line
59 image comment :F(readc)S(readi)
60 nextst IDENT(eof) :F(END)
61 OUTPUT _ space line
62 image _ line
63 readc line _ input :F(endgam)
64 line comment :S(print)
65 line continue _ :F(anlyz)
66 OUTPUT _ space cc line
67 image _ image line :(readc)
68 anlyz image statement _ :F(error)
69 DIFFER(image) :S(anlyz)F(nextst)
70 error OUTPUT _ '<<< syntatic error >>>' :(nextst)
71 print OUTPUT _ space line :(readc)
72 endgam eof _ 1 :(anlyz)
73
*
74 opt opt _ null ! pattern :(RETURN)
75 END
NO ERRORS DETECTED IN SOURCE PROGRAM
X _ Y+Z
<<< syntatic error >>>