@@ -66,50 +66,30 @@ accepting words ending with `00`.
6666
6767``` 
6868' We define a macro 'spec' for type definition 
69+ ' It is just an alias for the definition [:=] 
6970(new-declaration (spec X Y) (:= X Y)) 
7071
7172' We define a macro for type assertion 
7273(new-declaration (:: Tested Test) 
73-   (== @(interact @#Tested #Test) ok)) 
74+   (== @(interact @#Tested #Test) ok)) ' triggers interaction and expects [ok]  
7475
7576' The type [binary] is defined as a set of three interactive tests 
76- ' According to the previous macro, the tests passes  when interaction gives [ok] 
77+ ' According to the previous macro, the tests pass  when interaction gives [ok] 
7778(spec binary { 
78-   [(-i []) ok] 
79-   [(-i [0|X]) (+i X)] 
80-   [(-i [1|X]) (+i X)]}) 
81- 
82- ' Encoding of input words to feed the automaton 
83- (:= e (+i []))        (:: e binary) 
84- (:= 0 (+i [0]))       (:: 0 binary) 
85- (:= 000 (+i [0 0 0])) (:: 000 binary) 
86- (:= 010 (+i [0 1 0])) (:: 010 binary) 
87- (:= 110 (+i [1 1 0])) (:: 110 binary) 
88- 
89- ' We define macros for initial/accepting state and transitions 
90- ' to make the automaton more readable 
91- (:= (initial Q) [(-i W) (+a W Q)]) 
92- (:= (accept Q) [(-a [] Q) accept]) 
93- (:= (if read C1 on Q1 then Q2) [(-a [C1|W] Q1) (+a W Q2)]) 
94- 
95- ' Definition of the automaton 
96- (:= a1 { 
97-   #(initial q0) 
98-   #(accept q2) 
99-   #(if read 0 on q0 then q0) 
100-   #(if read 0 on q0 then q1) 
101-   #(if read 1 on q0 then q0) 
102-   #(if read 0 on q1 then q2)}) 
103- 
104- ' Define an expression that cancels terms starting with [-a] 
105- (:= kill (-a _ _)) 
106- 
107- ' Make the automata interact with words and remove unterminated execution paths 
108- ' Then display the result of interaction 
109- (show (process (interact @#e #a1)   #kill)) 
110- (show (process (interact @#000 #a1) #kill)) 
111- (show (process (interact @#010 #a1) #kill)) 
112- (show (process (interact @#110 #a1) #kill)) 
79+   [(-i []) ok]          ' returns [ok] on empty list 
80+   [(-i [0|X]) (+i X)]   ' matches on [0] and checks the tail 
81+   [(-i [1|X]) (+i X)]}) ' matches on [1] and checks the tail 
82+                         ' otherwise the term remains unchanged 
83+ 
84+ ' We define some words 
85+ (:= word1 (+i [0 1 1])) 
86+ (:= word2 (+i [2 3])) 
87+ 
88+ ' succeeds -> [ok] is obtained on interaction with test [binary] 
89+ (:: word1 binary) 
90+ 
91+ ' fails 
92+ ' (:: word2 binary) 
11393``` 
11494
11595More examples can be found in ` examples/ ` .
0 commit comments