Open main menu

Difference between revisions of "SCI/Specifications/SCI in action/Parser"

Merging of the SCI documentation. Work in progress.
(Merging of the SCI documentation. Work in progress.)
(Merging of the SCI documentation. Work in progress.)
Line 448: Line 448:
|Instructs Said() not to claim the event passed  to the previous Parse() call on a match. Used for succesive matching.
|Instructs Said() not to claim the event passed  to the previous Parse() call on a match. Used for succesive matching.
|}
|}
This sequence of operators and word groups is now used to build the Said tree <i>T</i><sub>&Sigma;</sub> . I will describe the algorithm used to generate <i>T</i><sub>&Sigma;</sub> by providing a grammar <i>G</i><sub>&Sigma;</sub> , with <i>L(G<sub>&Sigma;</sub>) </i>containing all valid Said specs. The semantics will be provided under each rule with a double arrow:
<syntax type="?">
        G\Sigma = ({saidspec, optcont, leftspec, midspec, rightspec, word, cwordset, wordset, expr, cwordrefset, wordrefset, recref}, \Gamma, P, saidspec)
        P := {
          saidspec \to  leftspec optcont
                                \Rightarrow (141 13f leftspec optcont)
                        | leftspec midspec optcont
                                \Rightarrow (141 13f leftspec midspec optcont)
                        | leftspec midspec rightspec optcont
                                \Rightarrow (141 13f leftspec midspec rightspec optcont)
          optcont \to  e
                                \Rightarrow
                        | >
                                \Rightarrow (14b f900 f900)
          leftspec \to  e
                                \Rightarrow
                        | expr
                                \Rightarrow (141 149 expr)
          midspec \to    / expr
                                \Rightarrow (142 14a expr)
                        | [ / expr ]
                                \Rightarrow (152 142 (142 14a expr))
                        | /
                                \Rightarrow
          rightspec \to  / expr
                                \Rightarrow (143 14a expr)
                        | [ / expr ]
                                \Rightarrow (152 143 (143 14a expr))
                        | /
                                \Rightarrow
          word \to      \gamma \in \Gamma
                                \Rightarrow (141 153 \gamma)
          cwordset \to  wordset
                                \Rightarrow (141 14f wordset)
                        | [ wordset ]
                                \Rightarrow (141 14f (152 14c (141 14f wordset)))
          wordset \to    word
                                \Rightarrow word
                        | ( expr )
                                \Rightarrow (141 14c expr)
                        | wordset , wordset
                                \Rightarrow wordset wordset
                        | wordset , [ wordset ]
                                \Rightarrow wordset wordset
          expr \to              cwordset cwordrefset
                                \Rightarrow cwordset cwordrefset
                        | cwordset
                                \Rightarrow cwordset
                        | cwordrefset
                                \Rightarrow cwordrefset
       
          cwordrefset \to        wordrefset
                                \Rightarrow wordrefset
                        | [ wordrefset ]
                                \Rightarrow (152 144 wordrefset)
          wordrefset \to        < wordset recref
                                \Rightarrow (144 14f word) recref
                        | < wordset
                                \Rightarrow (144 14f word)
                        | < [ wordset ]
                                \Rightarrow (152 144 (144 14f wordset))
          recref \to    < wordset recref
                                \Rightarrow (141 144 (144 14f wordset) recref)
                        | < wordset
                                \Rightarrow (141 144 (144 14f wordset))
        }
</syntax>


==Notes==
==Notes==
<references/>
<references/>
236

edits