# SOME DESCRIPTIVE TITLE # Copyright (C) YEAR Free Software Foundation, Inc. # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2021-11-07 12:12+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. type: top #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:6 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:65 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:83 #, no-wrap msgid "@value{TITLE}" msgstr "" #. type: include #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:7 #, no-wrap msgid "docstyle.texi" msgstr "" #. type: copying #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:29 msgid "" "Copyright @copyright{} 1988--1993, 1995, 1998--2004, 2007, 2012--2021 Free " "Software Foundation, Inc." msgstr "" #. type: quotation #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:45 msgid "" "Permission is granted to copy, distribute and/or modify this document under " "the terms of the GNU Free Documentation License, Version 1.3 or any later " "version published by the Free Software Foundation; with no Invariant " "Sections, with the Front-Cover Texts being ``A GNU Manual,'' and with the " "Back-Cover Texts as in (a) below. A copy of the license is included in the " "section entitled ``GNU Free Documentation License''." msgstr "" #. type: quotation #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:48 msgid "" "(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and modify " "this GNU manual.''" msgstr "" #. type: dircategory #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:51 #, no-wrap msgid "Emacs misc features" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:54 msgid "Wisent: (wisent)" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:54 msgid "Semantic Wisent parser development." msgstr "" #. type: author #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:66 #, no-wrap msgid "by @value{AUTHOR}" msgstr "" #. type: i{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:75 msgid "Semantic" msgstr "" #. type: node #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:82 #, no-wrap msgid "top" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:87 msgid "" "Wisent (the European Bison ;-) is an Emacs Lisp implementation of the GNU " "Compiler Compiler Bison." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:91 msgid "" "This manual describes how to use Wisent to develop grammars for programming " "languages, and how to use grammars to parse language source in Emacs " "buffers." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:94 msgid "" "It also describes how Wisent is used with the @semantic{} tool set described " "in the @ref{Top, Semantic Manual, Semantic Manual, semantic}." msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:106 msgid "Wisent Overview::" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:106 msgid "Wisent Grammar::" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:106 msgid "Wisent Parsing::" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:106 msgid "Wisent Semantic::" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:106 msgid "GNU Free Documentation License::" msgstr "" #. type: unnumbered #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:106 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:2027 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:2028 #, no-wrap msgid "Index" msgstr "" #. type: chapter #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:108 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:109 #, no-wrap msgid "Wisent Overview" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:114 msgid "" "@dfn{Wisent} (the European Bison) is an implementation in Emacs Lisp of the " "GNU Compiler Compiler Bison. Its code is a port of the C code of GNU Bison " "1.28 & 1.31." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:117 msgid "" "For more details on the basic concepts for understanding Wisent, it is " "worthwhile to read the @ref{Top, Bison Manual, , bison}." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:120 msgid "" "Wisent can generate compilers compatible with the @semantic{} tool set. See " "the @ref{Top, Semantic Manual, , semantic}." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:122 msgid "It benefits from these Bison features:" msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:127 msgid "" "It uses a fast but not so space-efficient encoding for the parse tables, " "described in Corbett's PhD thesis from Berkeley:" msgstr "" #. type: quotation #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:130 msgid "" "@cite{Static Semantics in Compiler Error Recovery}@* June 1985, Report " "No. UCB/CSD 85/251." msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:135 msgid "" "For generating the lookahead sets, Wisent uses the well-known technique of " "F. DeRemer and T. Pennello described in:" msgstr "" #. type: quotation #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:139 msgid "" "@cite{Efficient Computation of LALR(1) Look-Ahead Sets}@* October 1982, ACM " "TOPLAS Vol 4 No 4, 615--49, @uref{https://doi.org/10.1145/69622.357187}." msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:144 msgid "" "Wisent resolves shift/reduce conflicts using operator precedence and " "associativity." msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:148 msgid "" "Parser error recovery is accomplished using rules which match the special " "token @code{error}." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:152 msgid "" "Nevertheless there are some fundamental differences between Bison and " "Wisent." msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:158 msgid "" "Wisent is intended to be used in Emacs. It reads and produces Emacs Lisp " "data structures. All the additional code used in grammars is Emacs Lisp " "code." msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:166 msgid "" "Contrary to Bison, Wisent does not generate a parser which combines Emacs " "Lisp code and grammar constructs. They exist separately. Wisent reads the " "grammar from a Lisp data structure and then generates grammar constructs as " "tables. Afterward, the derived tables can be included and byte-compiled in " "separate Emacs Lisp files, and be used at a later time by the Wisent's " "parser engine." msgstr "" #. type: itemize #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:172 msgid "" "Wisent allows multiple start nonterminals and allows a call to the parsing " "function to be made for a particular start nonterminal. For example, this " "is particularly useful to parse a region of an Emacs buffer. @semantic{} " "heavily depends on the availability of this feature." msgstr "" #. type: chapter #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:174 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:175 #, no-wrap msgid "Wisent Grammar" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:177 #, no-wrap msgid "context-free grammar" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:178 #, no-wrap msgid "rule" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:183 msgid "" "In order for Wisent to parse a language, it must be described by a " "@dfn{context-free grammar}. That is a grammar specified as rules that can " "be applied regardless of context. For more information, see @ref{Language " "and Grammar, , , bison}, in the Bison manual." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:184 #, no-wrap msgid "terminal" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:185 #, no-wrap msgid "nonterminal" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:189 msgid "" "The formal grammar is formulated using @dfn{terminal} and @dfn{nonterminal} " "items. Terminals can be Emacs Lisp symbols or characters, and nonterminals " "are symbols only." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:190 #, no-wrap msgid "token" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:193 msgid "" "Terminals (also known as @dfn{tokens}) represent the lexical elements of the " "language like numbers, strings, etc.." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:195 msgid "For example @samp{PLUS} can represent the operator @samp{+}." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:197 msgid "Nonterminal symbols are described by rules:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:201 #, no-wrap msgid "RESULT @equiv{} COMPONENTS@dots{}\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:207 msgid "" "@samp{RESULT} is a nonterminal that this rule describes and " "@samp{COMPONENTS} are various terminals and nonterminals that are put " "together by this rule." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:209 msgid "For example, this rule:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:213 #, no-wrap msgid "exp @equiv{} exp PLUS exp\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:218 msgid "" "Says that two groupings of type @samp{exp}, with a @samp{PLUS} token in " "between, can be combined into a larger grouping of type @samp{exp}." msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:224 msgid "Grammar format::" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:224 msgid "Example::" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:224 msgid "Compiling a grammar::" msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:224 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:617 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:618 #, no-wrap msgid "Conflicts" msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:226 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:227 #, no-wrap msgid "Grammar format" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:229 #, no-wrap msgid "grammar format" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:233 msgid "" "To be acceptable by Wisent a context-free grammar must respect a particular " "format. That is, must be represented as an Emacs Lisp list of the form:" msgstr "" #. type: code{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:235 msgid "(@var{terminals} @var{assocs} . @var{non-terminals})" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:237 #, no-wrap msgid "terminals" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:239 msgid "Is the list of terminal symbols used in the grammar." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:240 #, no-wrap msgid "associativity" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:241 #, no-wrap msgid "assocs" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:245 msgid "" "Specify the associativity of @var{terminals}. It is @code{nil} when there " "is no associativity defined, or an alist of @w{@code{(@var{assoc-type} " ". @var{assoc-value})}} elements." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:251 msgid "" "@var{assoc-type} must be one of the @code{default-prec}, @code{nonassoc}, " "@code{left} or @code{right} symbols. When @var{assoc-type} is " "@code{default-prec}, @var{assoc-value} must be @code{nil} or @code{t} (the " "default). Otherwise it is a list of tokens which must have been previously " "declared in @var{terminals}." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:254 msgid "" "For details, see @ref{Contextual Precedence, , , bison}, in the Bison " "manual." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:255 #, no-wrap msgid "non-terminals" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:257 msgid "Is the list of nonterminal definitions. Each definition has the form:" msgstr "" #. type: code{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:259 msgid "(@var{nonterm} . @var{rules})" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:263 msgid "" "Where @var{nonterm} is the nonterminal symbol defined and @var{rules} the " "list of rules that describe this nonterminal. Each rule is a list:" msgstr "" #. type: code{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:265 msgid "(@var{components} [@var{precedence}] [@var{action}])" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:267 msgid "Where:" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:269 #, no-wrap msgid "components" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:272 msgid "" "Is a list of various terminals and nonterminals that are put together by " "this rule." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:274 msgid "For example," msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:279 #, no-wrap msgid "" "(exp ((exp ?+ exp)) ;; exp: exp '+' exp\n" " ) ;; ;\n" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:284 msgid "" "Says that two groupings of type @samp{exp}, with a @samp{+} token in " "between, can be combined into a larger grouping of type @samp{exp}." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:285 #, no-wrap msgid "grammar coding conventions" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:294 msgid "" "By convention, a nonterminal symbol should be in lower case, such as " "@samp{exp}, @samp{stmt} or @samp{declaration}. Terminal symbols should be " "upper case to distinguish them from nonterminals: for example, " "@samp{INTEGER}, @samp{IDENTIFIER}, @samp{IF} or @samp{RETURN}. A terminal " "symbol that represents a particular keyword in the language is " "conventionally the same as that keyword converted to upper case. The " "terminal symbol @code{error} is reserved for error recovery." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:295 #, no-wrap msgid "middle-rule actions" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:298 msgid "" "Scattered among the components can be @dfn{middle-rule} actions. Usually " "only @var{action} is provided (@pxref{action})." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:302 msgid "" "If @var{components} in a rule is @code{nil}, it means that the rule can " "match the empty string. For example, here is how to define a " "comma-separated sequence of zero or more @samp{exp} groupings:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:308 #, no-wrap msgid "" "(expseq (nil) ;; expseq: ;; empty\n" " ((expseq1)) ;; | expseq1\n" " ) ;; ;\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:312 #, no-wrap msgid "" "(expseq1 ((exp)) ;; expseq1: exp\n" " ((expseq1 ?, exp)) ;; | expseq1 ',' exp\n" " ) ;; ;\n" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:315 #, no-wrap msgid "precedence level" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:316 #, no-wrap msgid "precedence" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:322 msgid "" "Assign the rule the precedence of the given terminal item, overriding the " "precedence that would be deduced for it, that is the one of the last " "terminal in it. Notice that only terminals declared in @var{assocs} have a " "precedence level. The altered rule precedence then affects how conflicts " "involving that rule are resolved." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:324 msgid "@var{precedence} is an optional vector of one terminal item." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:329 msgid "" "Here is how @var{precedence} solves the problem of unary minus. First, " "declare a precedence for a fictitious terminal symbol named @code{UMINUS}. " "There are no tokens of this type, but the symbol serves to stand for its " "precedence:" msgstr "" #. type: example #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:336 #, no-wrap msgid "" "@dots{}\n" "((default-prec t) ;; This is the default\n" " (left '+' '-')\n" " (left '*')\n" " (left UMINUS))\n" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:339 msgid "Now the precedence of @code{UMINUS} can be used in specific rules:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:348 #, no-wrap msgid "" "(exp @dots{} ;; exp: @dots{}\n" " ((exp ?- exp)) ;; | exp '-' exp\n" " @dots{} ;; @dots{}\n" " ((?- exp) [UMINUS]) ;; | '-' exp %prec UMINUS\n" " @dots{} ;; @dots{}\n" " ) ;; ;\n" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:355 msgid "" "If you forget to append @code{[UMINUS]} to the rule for unary minus, Wisent " "silently assumes that minus has its usual precedence. This kind of problem " "can be tricky to debug, since one typically discovers the mistake only by " "testing the code." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:361 msgid "" "Using @code{(default-prec nil)} declaration makes it easier to discover this " "kind of problem systematically. It causes rules that lack a " "@var{precedence} modifier to have no precedence, even if the last terminal " "symbol mentioned in their components has a declared precedence." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:369 msgid "" "If @code{(default-prec nil)} is in effect, you must specify @var{precedence} " "for all rules that participate in precedence conflict resolution. Then you " "will see any shift/reduce conflict until you tell Wisent how to resolve it, " "either by changing your grammar or by adding an explicit precedence. This " "will probably add declarations to the grammar, but it helps to protect " "against incorrect rule precedences." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:372 msgid "" "The effect of @code{(default-prec nil)} can be reversed by giving " "@code{(default-prec t)}, which is the default." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:375 msgid "" "For more details, see @ref{Contextual Precedence, , , bison}, in the Bison " "manual." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:381 msgid "" "It is important to understand that @var{assocs} declarations defines " "associativity but also assign a precedence level to terminals. All " "terminals declared in the same @code{left}, @code{right} or @code{nonassoc} " "association get the same precedence level. The precedence level is " "increased at each new association." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:384 msgid "" "On the other hand, @var{precedence} explicitly assign the precedence level " "of the given terminal to a rule." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:385 #, no-wrap msgid "semantic actions" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:386 #, no-wrap msgid "action" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:388 msgid "An action is an optional Emacs Lisp function call, like this:" msgstr "" #. type: code{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:390 msgid "(identity $1)" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:392 msgid "The result of an action determines the semantic value of a rule." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:396 msgid "" "From an implementation standpoint, the function call will be embedded in a " "lambda expression, and several useful local variables will be defined:" msgstr "" #. type: vindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:398 #, no-wrap msgid "$N" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:399 #, no-wrap msgid "$@var{n}" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:404 msgid "" "Where @var{n} is a positive integer. Like in Bison, the value of " "@code{$@var{n}} is the semantic value of the @var{n}th element of " "@var{components}, starting from 1. It can be of any Lisp data type." msgstr "" #. type: vindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:405 #, no-wrap msgid "$region@var{n}" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:406 #, no-wrap msgid "$regionN" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:414 msgid "" "Where @var{n} is a positive integer. For each @code{$@var{n}} variable " "defined there is a corresponding @code{$region@var{n}} variable. Its value " "is a pair @code{(@var{start-pos} . @var{end-pos})} that represent the start " "and end positions (in the lexical input stream) of the @code{$@var{n}} " "value. It can be @code{nil} when the component positions are not available, " "like for an empty string component for example." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:415 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:416 #, no-wrap msgid "$region" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:421 msgid "" "Its value is the leftmost and rightmost positions of input data matched by " "all @var{components} in the rule. This is a pair @code{(@var{leftmost-pos} " ". @var{rightmost-pos})}. It can be @code{nil} when components positions " "are not available." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:422 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:423 #, no-wrap msgid "$nterm" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:429 msgid "" "This variable is initialized with the nonterminal symbol (@var{nonterm}) the " "rule belongs to. It could be useful to improve error reporting or " "debugging. It is also used to automatically provide incremental re-parse " "entry points for @semantic{} tags (@pxref{Wisent Semantic})." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:430 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:431 #, no-wrap msgid "$action" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:434 msgid "" "The value of @code{$action} is the symbolic name of the current semantic " "action (@pxref{Debugging actions})." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:441 msgid "" "When an action is not specified a default value is supplied, it is " "@code{(identity $1)}. This means that the default semantic value of a rule " "is the value of its first component. Excepted for a rule matching the empty " "string, for which the default action is to return @code{nil}." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:444 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:445 #, no-wrap msgid "Example" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:447 #, no-wrap msgid "grammar example" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:450 msgid "" "Here is an example to parse simple infix arithmetic expressions. See " "@ref{Infix Calc, , , bison}, in the Bison manual for details." msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:456 #, no-wrap msgid "" "'(\n" " ;; Terminals\n" " (NUM)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:463 #, no-wrap msgid "" " ;; Terminal associativity & precedence\n" " ((nonassoc ?=)\n" " (left ?- ?+)\n" " (left ?* ?/)\n" " (left NEG)\n" " (right ?^))\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:470 #, no-wrap msgid "" " ;; Rules\n" " (input\n" " ((line))\n" " ((input line)\n" " (format \"%s %s\" $1 $2))\n" " )\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:479 #, no-wrap msgid "" " (line\n" " ((?;)\n" " (progn \";\"))\n" " ((exp ?;)\n" " (format \"%s;\" $1))\n" " ((error ?;)\n" " (progn \"Error;\")))\n" " )\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:501 #, no-wrap msgid "" " (exp\n" " ((NUM)\n" " (string-to-number $1))\n" " ((exp ?= exp)\n" " (= $1 $3))\n" " ((exp ?+ exp)\n" " (+ $1 $3))\n" " ((exp ?- exp)\n" " (- $1 $3))\n" " ((exp ?* exp)\n" " (* $1 $3))\n" " ((exp ?/ exp)\n" " (/ $1 $3))\n" " ((?- exp) [NEG]\n" " (- $2))\n" " ((exp ?^ exp)\n" " (expt $1 $3))\n" " ((?\\( exp ?\\))\n" " (progn $2))\n" " )\n" " )\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:506 msgid "" "In the bison-like @dfn{WY} format (@pxref{Wisent Semantic}) the grammar " "looks like this:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:510 #, no-wrap msgid "" "%token NUM\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:516 #, no-wrap msgid "" "%nonassoc '=' ;; comparison\n" "%left '-' '+'\n" "%left '*' '/'\n" "%left NEG ;; negation--unary minus\n" "%right '^' ;; exponentiation\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:518 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:1749 #, no-wrap msgid "" "%%\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:524 #, no-wrap msgid "" "input:\n" " line\n" " | input line\n" " (format \"%s %s\" $1 $2)\n" " ;\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:533 #, no-wrap msgid "" "line:\n" " ';'\n" " @{\";\"@}\n" " | exp ';'\n" " (format \"%s;\" $1)\n" " | error ';'\n" " @{\"Error;\"@}\n" " ;\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:554 #, no-wrap msgid "" "exp:\n" " NUM\n" " (string-to-number $1)\n" " | exp '=' exp\n" " (= $1 $3)\n" " | exp '+' exp\n" " (+ $1 $3)\n" " | exp '-' exp\n" " (- $1 $3)\n" " | exp '*' exp\n" " (* $1 $3)\n" " | exp '/' exp\n" " (/ $1 $3)\n" " | '-' exp %prec NEG\n" " (- $2)\n" " | exp '^' exp\n" " (expt $1 $3)\n" " | '(' exp ')'\n" " @{$2@}\n" " ;\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:556 #, no-wrap msgid "%%\n" msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:559 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:560 #, no-wrap msgid "Compiling a grammar" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:562 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:1138 #, no-wrap msgid "automaton" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:567 msgid "" "After providing a context-free grammar in a suitable format, it must be " "translated into a set of tables (an @dfn{automaton}) that will be used to " "derive the parser. Like Bison, Wisent translates grammars that must be " "@dfn{LALR(1)}." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:568 #, no-wrap msgid "LALR(1) grammar" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:569 #, no-wrap msgid "look-ahead token" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:574 msgid "" "A grammar is @acronym{LALR(1)} if it is possible to tell how to parse any " "portion of an input string with just a single token of look-ahead: the " "@dfn{look-ahead token}. See @ref{Language and Grammar, , , bison}, in the " "Bison manual for more information." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:575 #, no-wrap msgid "grammar compilation" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:577 msgid "Grammar translation (compilation) is achieved by the function:" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:578 #, no-wrap msgid "compiling a grammar" msgstr "" #. type: vindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:579 #, no-wrap msgid "wisent-single-start-flag" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:580 #, no-wrap msgid "wisent-compile-grammar" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:581 #, no-wrap msgid "wisent-compile-grammar grammar &optional start-list" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:583 msgid "Compile @var{grammar} and return an @acronym{LALR(1)} automaton." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:592 msgid "" "Optional argument @var{start-list} is a list of start symbols " "(nonterminals). If @code{nil} the first nonterminal defined in the grammar " "is the default start symbol. If @var{start-list} contains only one element, " "it defines the start symbol. If @var{start-list} contains more than one " "element, all are defined as potential start symbols, unless " "@code{wisent-single-start-flag} is non-@code{nil}. In that case the first " "element of @var{start-list} defines the start symbol and others are ignored." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:594 msgid "The @acronym{LALR(1)} automaton is a vector of the form:" msgstr "" #. type: code{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:596 msgid "[@var{actions gotos starts functions}]" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:598 #, no-wrap msgid "actions" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:602 msgid "" "A state/token matrix telling the parser what to do at every state based on " "the current look-ahead token. That is shift, reduce, accept or error. See " "also @ref{Wisent Parsing}." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:603 #, no-wrap msgid "gotos" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:606 msgid "" "A state/nonterminal matrix telling the parser the next state to go to after " "reducing with each rule." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:607 #, no-wrap msgid "starts" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:610 msgid "" "An alist which maps the allowed start symbols (nonterminals) to lexical " "tokens that will be first shifted into the parser stack." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:611 #, no-wrap msgid "functions" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:614 msgid "" "An obarray of semantic action symbols. A semantic action is actually an " "Emacs Lisp function (lambda expression)." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:622 msgid "" "Normally, a grammar should produce an automaton where at each state the " "parser has only one action to do (@pxref{Wisent Parsing})." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:623 #, no-wrap msgid "ambiguous grammar" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:627 msgid "" "In certain cases, a grammar can produce an automaton where, at some states, " "there are more than one action possible. Such a grammar is @dfn{ambiguous}, " "and generates @dfn{conflicts}." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:628 #, no-wrap msgid "deterministic automaton" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:633 msgid "" "The parser can't be driven by an automaton which isn't completely " "@dfn{deterministic}, that is which contains conflicts. It is necessary to " "resolve the conflicts to eliminate them. Wisent resolves conflicts like " "Bison does." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:634 #, no-wrap msgid "grammar conflicts" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:635 #, no-wrap msgid "conflicts resolution" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:637 msgid "There are two sorts of conflicts:" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:639 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:640 #, no-wrap msgid "shift/reduce conflicts" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:642 msgid "When either a shift or a reduction would be valid at the same state." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:647 msgid "" "Such conflicts are resolved by choosing to shift, unless otherwise directed " "by operator precedence declarations. See @ref{Shift/Reduce , , , bison}, in " "the Bison manual for more information." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:648 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:649 #, no-wrap msgid "reduce/reduce conflicts" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:653 msgid "" "That occurs if there are two or more rules that apply to the same sequence " "of input. This usually indicates a serious error in the grammar." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:659 msgid "" "Such conflicts are resolved by choosing to use the rule that appears first " "in the grammar, but it is very risky to rely on this. Every reduce/reduce " "conflict must be studied and usually eliminated. See @ref{Reduce/Reduce , , " ", bison}, in the Bison manual for more information." msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:664 msgid "Grammar Debugging::" msgstr "" #. type: subsection #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:664 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:717 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:718 #, no-wrap msgid "Understanding the automaton" msgstr "" #. type: node #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:666 #, no-wrap msgid "Grammar Debugging" msgstr "" #. type: subsection #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:667 #, no-wrap msgid "Grammar debugging" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:669 #, no-wrap msgid "grammar debugging" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:670 #, no-wrap msgid "grammar verbose description" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:675 msgid "" "To help writing a new grammar, @code{wisent-compile-grammar} can produce a " "verbose report containing a detailed description of the grammar and parser " "(equivalent to what Bison reports with the @option{--verbose} option)." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:678 msgid "To enable the verbose report you can set to non-@code{nil} the variable:" msgstr "" #. type: vindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:679 #, no-wrap msgid "wisent-verbose-flag" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:680 #, no-wrap msgid "Option wisent-verbose-flag" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:682 msgid "non-@code{nil} means to report verbose information on generated parser." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:685 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:1294 msgid "Or interactively use the command:" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:686 #, no-wrap msgid "wisent-toggle-verbose-flag" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:687 #, no-wrap msgid "Command wisent-toggle-verbose-flag" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:689 msgid "Toggle whether to report verbose information on generated parser." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:695 msgid "" "The verbose report is printed in the temporary buffer @file{*wisent-log*} " "when running interactively, or in file @file{wisent.output} when running in " "batch mode. Different reports are separated from each other by a line like " "this:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:699 #, no-wrap msgid "*** Wisent @var{source-file} - 2002-06-27 17:33\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:705 msgid "" "where @var{source-file} is the name of the Emacs Lisp file from which the " "grammar was read. See @ref{Understanding the automaton}, for details on the " "verbose report." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:707 #, no-wrap msgid "Please Note" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:710 msgid "" "To help debugging the grammar compiler itself, you can set this variable to " "print the content of some internal data structures:" msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:711 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:712 #, no-wrap msgid "wisent-debug-flag" msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:714 msgid "non-@code{nil} means enable some debug stuff." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:720 #, no-wrap msgid "understanding the automaton" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:724 msgid "" "This section (took from the manual of Bison 1.49) describes how to use the " "verbose report printed by @code{wisent-compile-grammar} to understand the " "generated automaton, to tune or fix a grammar." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:726 msgid "We will use the following example:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:732 #, no-wrap msgid "" "(let ((wisent-verbose-flag t)) ;; Print a verbose report!\n" " (wisent-compile-grammar\n" " '((NUM STR) ; %token NUM STR\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:735 #, no-wrap msgid "" " ((left ?+ ?-) ; %left '+' '-';\n" " (left ?*)) ; %left '*'\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:743 #, no-wrap msgid "" " (exp ; exp:\n" " ((exp ?+ exp)) ; exp '+' exp\n" " ((exp ?- exp)) ; | exp '-' exp\n" " ((exp ?* exp)) ; | exp '*' exp\n" " ((exp ?/ exp)) ; | exp '/' exp\n" " ((NUM)) ; | NUM\n" " ) ; ;\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:750 #, no-wrap msgid "" " (useless ; useless:\n" " ((STR)) ; STR\n" " ) ; ;\n" " )\n" " 'nil) ; no %start declarations\n" " )\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:755 msgid "" "When evaluating the above expression, grammar compilation first issues the " "following two clear messages:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:760 #, no-wrap msgid "" "Grammar contains 1 useless nonterminals and 1 useless rules\n" "Grammar contains 7 shift/reduce conflicts\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:764 msgid "The @file{*wisent-log*} buffer details things!" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:767 msgid "" "The first section reports conflicts that were solved using precedence and/or " "associativity:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:779 #, no-wrap msgid "" "Conflict in state 7 between rule 1 and token '+' resolved as reduce.\n" "Conflict in state 7 between rule 1 and token '-' resolved as reduce.\n" "Conflict in state 7 between rule 1 and token '*' resolved as shift.\n" "Conflict in state 8 between rule 2 and token '+' resolved as reduce.\n" "Conflict in state 8 between rule 2 and token '-' resolved as reduce.\n" "Conflict in state 8 between rule 2 and token '*' resolved as shift.\n" "Conflict in state 9 between rule 3 and token '+' resolved as reduce.\n" "Conflict in state 9 between rule 3 and token '-' resolved as reduce.\n" "Conflict in state 9 between rule 3 and token '*' resolved as reduce.\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:784 msgid "" "The next section reports useless tokens, nonterminal and rules (note that " "useless tokens might be used by the scanner):" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:788 #, no-wrap msgid "" "Useless nonterminals:\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:790 #, no-wrap msgid "" " useless\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:793 #, no-wrap msgid "" "Terminals which are not used:\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:795 #, no-wrap msgid "" " STR\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:798 #, no-wrap msgid "" "Useless rules:\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:800 #, no-wrap msgid "#6 useless: STR;\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:804 msgid "The next section lists states that still have conflicts:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:811 #, no-wrap msgid "" "State 7 contains 1 shift/reduce conflict.\n" "State 8 contains 1 shift/reduce conflict.\n" "State 9 contains 1 shift/reduce conflict.\n" "State 10 contains 4 shift/reduce conflicts.\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:815 msgid "The next section reproduces the grammar used:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:819 #, no-wrap msgid "" "Grammar\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:826 #, no-wrap msgid "" " Number, Rule\n" " 1 exp -> exp '+' exp\n" " 2 exp -> exp '-' exp\n" " 3 exp -> exp '*' exp\n" " 4 exp -> exp '/' exp\n" " 5 exp -> NUM\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:830 msgid "And reports the uses of the symbols:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:834 #, no-wrap msgid "" "Terminals, with rules where they appear\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:843 #, no-wrap msgid "" "$EOI (-1)\n" "error (1)\n" "NUM (2) 5\n" "STR (3) 6\n" "'+' (4) 1\n" "'-' (5) 2\n" "'*' (6) 3\n" "'/' (7) 4\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:846 #, no-wrap msgid "" "Nonterminals, with rules where they appear\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:849 #, no-wrap msgid "" "exp (8)\n" " on left: 1 2 3 4 5, on right: 1 2 3 4\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:856 msgid "" "The report then details the automaton itself, describing each state with it " "set of @dfn{items}, also known as @dfn{pointed rules}. Each item is a " "production rule together with a point (marked by @samp{.}) that the input " "cursor." msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:860 #, no-wrap msgid "" "state 0\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:862 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:922 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:939 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:949 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:959 #, no-wrap msgid "" " NUM shift, and go to state 1\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:864 #, no-wrap msgid " exp go to state 2\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:874 msgid "" "State 0 corresponds to being at the very beginning of the parsing, in the " "initial rule, right before the start symbol (@samp{exp}). When the parser " "returns to this state right after having reduced a rule that produced an " "@samp{exp}, it jumps to state 2. If there is no such transition on a " "nonterminal symbol, and the lookahead is a @samp{NUM}, then this token is " "shifted on the parse stack, and the control flow jumps to state 1. Any " "other lookahead triggers a parse error." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:876 msgid "In the state 1..." msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:880 #, no-wrap msgid "" "state 1\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:882 #, no-wrap msgid "" " exp -> NUM . (rule 5)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:884 #, no-wrap msgid " $default reduce using rule 5 (exp)\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:891 msgid "" "the rule 5, @samp{exp: NUM;}, is completed. Whatever the lookahead " "(@samp{$default}), the parser will reduce it. If it was coming from state " "0, then, after this reduction it will return to state 0, and will jump to " "state 2 (@samp{exp: go to state 2})." msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:895 #, no-wrap msgid "" "state 2\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:900 #, no-wrap msgid "" " exp -> exp . '+' exp (rule 1)\n" " exp -> exp . '-' exp (rule 2)\n" " exp -> exp . '*' exp (rule 3)\n" " exp -> exp . '/' exp (rule 4)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:906 #, no-wrap msgid "" " $EOI shift, and go to state 11\n" " '+' shift, and go to state 3\n" " '-' shift, and go to state 4\n" " '*' shift, and go to state 5\n" " '/' shift, and go to state 6\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:914 msgid "" "In state 2, the automaton can only shift a symbol. For instance, because of " "the item @samp{exp -> exp . '+' exp}, if the lookahead if @samp{+}, it will " "be shifted on the parse stack, and the automaton control will jump to state " "3, corresponding to the item @samp{exp -> exp . '+' exp}:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:918 #, no-wrap msgid "" "state 3\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:920 #, no-wrap msgid "" " exp -> exp '+' . exp (rule 1)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:924 #, no-wrap msgid " exp go to state 7\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:929 msgid "" "Since there is no default action, any other token than those listed above " "will trigger a parse error." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:931 msgid "The interpretation of states 4 to 6 is straightforward:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:935 #, no-wrap msgid "" "state 4\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:937 #, no-wrap msgid "" " exp -> exp '-' . exp (rule 2)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:941 #, no-wrap msgid "" " exp go to state 8\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:945 #, no-wrap msgid "" "state 5\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:947 #, no-wrap msgid "" " exp -> exp '*' . exp (rule 3)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:951 #, no-wrap msgid "" " exp go to state 9\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:955 #, no-wrap msgid "" "state 6\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:957 #, no-wrap msgid "" " exp -> exp '/' . exp (rule 4)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:961 #, no-wrap msgid " exp go to state 10\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:966 msgid "" "As was announced in beginning of the report, @samp{State 7 contains 1 " "shift/reduce conflict.}:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:970 #, no-wrap msgid "" "state 7\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:976 #, no-wrap msgid "" " exp -> exp . '+' exp (rule 1)\n" " exp -> exp '+' exp . (rule 1)\n" " exp -> exp . '-' exp (rule 2)\n" " exp -> exp . '*' exp (rule 3)\n" " exp -> exp . '/' exp (rule 4)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:979 /Users/suzume/Documents/Repositories/Projet #: OmegaT de Documentation Emacs - Sources/doc/misc/wisent.texi:1025 #, no-wrap msgid "" " '*' shift, and go to state 5\n" " '/' shift, and go to state 6\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:982 #, no-wrap msgid "" " '/' [reduce using rule 1 (exp)]\n" " $default reduce using rule 1 (exp)\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:993 msgid "" "Indeed, there are two actions associated to the lookahead @samp{/}: either " "shifting (and going to state 6), or reducing rule 1. The conflict means " "that either the grammar is ambiguous, or the parser lacks information to " "make the right decision. Indeed the grammar is ambiguous, as, since we did " "not specify the precedence of @samp{/}, the sentence @samp{NUM + NUM / NUM} " "can be parsed as @samp{NUM + (NUM / NUM)}, which corresponds to shifting " "@samp{/}, or as @samp{(NUM + NUM) / NUM}, which corresponds to reducing rule " "1." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:998 msgid "" "Because in @acronym{LALR(1)} parsing a single decision can be made, Wisent " "arbitrarily chose to disable the reduction, see @ref{Conflicts}. Discarded " "actions are reported in between square brackets." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1010 msgid "" "Note that all the previous states had a single possible action: either " "shifting the next token and going to the corresponding state, or reducing a " "single rule. In the other cases, i.e., when shifting @emph{and} reducing is " "possible or when @emph{several} reductions are possible, the lookahead is " "required to select the action. State 7 is one such state: if the lookahead " "is @samp{*} or @samp{/} then the action is shifting, otherwise the action is " "reducing rule 1. In other words, the first two items, corresponding to rule " "1, are not eligible when the lookahead is @samp{*}, since we specified that " "@samp{*} has higher precedence that @samp{+}. More generally, some items " "are eligible only with some set of possible lookaheads." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1012 msgid "States 8 to 10 are similar:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1016 #, no-wrap msgid "" "state 8\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1022 #, no-wrap msgid "" " exp -> exp . '+' exp (rule 1)\n" " exp -> exp . '-' exp (rule 2)\n" " exp -> exp '-' exp . (rule 2)\n" " exp -> exp . '*' exp (rule 3)\n" " exp -> exp . '/' exp (rule 4)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1028 #, no-wrap msgid "" " '/' [reduce using rule 2 (exp)]\n" " $default reduce using rule 2 (exp)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1031 #, no-wrap msgid "" "state 9\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1037 #, no-wrap msgid "" " exp -> exp . '+' exp (rule 1)\n" " exp -> exp . '-' exp (rule 2)\n" " exp -> exp . '*' exp (rule 3)\n" " exp -> exp '*' exp . (rule 3)\n" " exp -> exp . '/' exp (rule 4)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1039 #, no-wrap msgid "" " '/' shift, and go to state 6\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1042 #, no-wrap msgid "" " '/' [reduce using rule 3 (exp)]\n" " $default reduce using rule 3 (exp)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1045 #, no-wrap msgid "" "state 10\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1051 #, no-wrap msgid "" " exp -> exp . '+' exp (rule 1)\n" " exp -> exp . '-' exp (rule 2)\n" " exp -> exp . '*' exp (rule 3)\n" " exp -> exp . '/' exp (rule 4)\n" " exp -> exp '/' exp . (rule 4)\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1056 #, no-wrap msgid "" " '+' shift, and go to state 3\n" " '-' shift, and go to state 4\n" " '*' shift, and go to state 5\n" " '/' shift, and go to state 6\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1062 #, no-wrap msgid "" " '+' [reduce using rule 4 (exp)]\n" " '-' [reduce using rule 4 (exp)]\n" " '*' [reduce using rule 4 (exp)]\n" " '/' [reduce using rule 4 (exp)]\n" " $default reduce using rule 4 (exp)\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1068 msgid "" "Observe that state 10 contains conflicts due to the lack of precedence of " "@samp{/} wrt @samp{+}, @samp{-}, and @samp{*}, but also because the " "associativity of @samp{/} is not specified." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1071 msgid "" "Finally, the state 11 (plus 12) is named the @dfn{final state}, or the " "@dfn{accepting state}:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1075 #, no-wrap msgid "" "state 11\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1077 #, no-wrap msgid "" " $EOI shift, and go to state 12\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1081 #, no-wrap msgid "" "state 12\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1083 #, no-wrap msgid " $default accept\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1088 msgid "" "The end of input is shifted @samp{$EOI shift,} and the parser exits " "successfully (@samp{go to state 12}, that terminates)." msgstr "" #. type: chapter #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1089 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1090 #, no-wrap msgid "Wisent Parsing" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1092 #, no-wrap msgid "bottom-up parser" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1093 #, no-wrap msgid "shift-reduce parser" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1096 msgid "" "The Wisent's parser is what is called a @dfn{bottom-up} or " "@dfn{shift-reduce} parser which repeatedly:" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1098 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1099 #, no-wrap msgid "shift" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1102 msgid "" "That is pushes the value of the last lexical token read (the look-ahead " "token) into a value stack, and reads a new one." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1103 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1104 #, no-wrap msgid "reduce" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1109 msgid "" "That is replaces a nonterminal by its semantic value. The values of the " "components which form the right hand side of a rule are popped from the " "value stack and reduced by the semantic action of this rule. The result is " "pushed back on top of value stack." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1112 msgid "The parser will stop on:" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1114 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1115 #, no-wrap msgid "accept" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1118 msgid "" "When all input has been successfully parsed. The semantic value of the " "start nonterminal is on top of the value stack." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1119 #, no-wrap msgid "syntax error" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1120 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1146 #, no-wrap msgid "error" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1124 msgid "" "When a syntax error (an unexpected token in input) has been detected. At " "this point the parser issues an error message and either stops or calls a " "recovery routine to try to resume parsing." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1126 #, no-wrap msgid "table-driven parser" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1130 msgid "" "The above elementary actions are driven by the @acronym{LALR(1)} automaton " "built by @code{wisent-compile-grammar} from a context-free grammar." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1132 msgid "The Wisent's parser is entered by calling the function:" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1133 #, no-wrap msgid "wisent-parse" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1134 #, no-wrap msgid "wisent-parse automaton lexer &optional error start" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1136 msgid "Parse input using the automaton specified in @var{automaton}." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1141 msgid "" "Is an @acronym{LALR(1)} automaton generated by @code{wisent-compile-grammar} " "(@pxref{Wisent Grammar})." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1142 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1187 #, no-wrap msgid "lexer" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1145 msgid "" "Is a function with no argument called by the parser to obtain the next " "terminal (token) in input (@pxref{Writing a lexer})." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1150 msgid "" "Is an optional reporting function called when a parse error occurs. It " "receives a message string to report. It defaults to the function " "@code{wisent-message} (@pxref{Report errors})." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1151 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1210 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1981 #, no-wrap msgid "start" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1155 msgid "" "Specify the start symbol (nonterminal) used by the parser as its goal. It " "defaults to the start symbol defined in the grammar (@pxref{Wisent " "Grammar})." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1160 msgid "" "The following two normal hooks permit doing some useful processing " "respectively before starting parsing, and after the parser terminated." msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1161 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1162 #, no-wrap msgid "wisent-pre-parse-hook" msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1164 msgid "Normal hook run just before entering the @var{LR} parser engine." msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1166 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1167 #, no-wrap msgid "wisent-post-parse-hook" msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1169 msgid "Normal hook run just after the @var{LR} parser engine terminated." msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1177 msgid "Writing a lexer::" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1177 msgid "Actions goodies::" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1177 msgid "Report errors::" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1177 msgid "Error recovery::" msgstr "" #. type: node #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1177 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1496 #, no-wrap msgid "Debugging actions" msgstr "" #. type: node #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1179 #, no-wrap msgid "Writing a lexer" msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1180 #, no-wrap msgid "What the parser must receive" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1185 msgid "" "It is important to understand that the parser does not parse characters, but " "lexical tokens, and does not know anything about characters in text streams!" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1186 #, no-wrap msgid "lexical analysis" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1188 #, no-wrap msgid "scanner" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1193 msgid "" "Reading input data to produce lexical tokens is performed by a lexer (also " "called a scanner) in a lexical analysis step, before the syntax analysis " "step performed by the parser. The parser automatically calls the lexer when " "it needs the next token to parse." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1194 #, no-wrap msgid "lexical tokens" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1197 msgid "" "A Wisent's lexer is an Emacs Lisp function with no argument. It must return " "a valid lexical token of the form:" msgstr "" #. type: code{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1199 msgid "(@var{token-class value} [@var{start} . @var{end}])" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1201 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1977 #, no-wrap msgid "token-class" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1205 msgid "" "Is a category of lexical token identifying a terminal as specified in the " "grammar (@pxref{Wisent Grammar}). It can be a symbol or a character " "literal." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1206 #, no-wrap msgid "value" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1209 msgid "" "Is the value of the lexical token. It can be of any valid Emacs Lisp data " "type." msgstr "" #. type: itemx #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1211 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1982 #, no-wrap msgid "end" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1214 msgid "" "Are the optional beginning and ending positions of @var{value} in the input " "stream." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1218 msgid "" "When there are no more tokens to read the lexer must return the token " "@code{(list wisent-eoi-term)} to each request." msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1219 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1220 #, no-wrap msgid "wisent-eoi-term" msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1222 msgid "Predefined constant, End-Of-Input terminal symbol." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1227 msgid "" "@code{wisent-lex} is an example of a lexer that reads lexical tokens " "produced by a @semantic{} lexer, and translates them into lexical tokens " "suitable to the Wisent parser. See also @ref{Wisent Lex}." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1230 msgid "" "To call the lexer in a semantic action use the function " "@code{wisent-lexer}. See also @ref{Actions goodies}." msgstr "" #. type: node #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1231 #, no-wrap msgid "Actions goodies" msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1232 #, no-wrap msgid "Variables and macros useful in grammar actions." msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1234 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1235 #, no-wrap msgid "wisent-input" msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1238 msgid "" "The last token read. This variable only has meaning in the scope of " "@code{wisent-parse}." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1240 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1241 #, no-wrap msgid "wisent-lexer" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1243 msgid "Obtain the next terminal in input." msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1245 #, no-wrap msgid "wisent-region" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1246 #, no-wrap msgid "wisent-region &rest positions" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1253 msgid "" "Return the start/end positions of the region including @var{positions}. " "Each element of @var{positions} is a pair @w{@code{(@var{start-pos} . " "@var{end-pos})}} or @code{nil}. The returned value is the pair " "@w{@code{(@var{min-start-pos} . @var{max-end-pos})}} or @code{nil} if no " "@var{positions} are available." msgstr "" #. type: node #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1255 #, no-wrap msgid "Report errors" msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1256 #, no-wrap msgid "The error reporting function" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1258 #, no-wrap msgid "error reporting" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1262 msgid "" "When the parser encounters a syntax error it calls a user-defined function. " "It must be an Emacs Lisp function with one argument: a string containing the " "message to report." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1264 msgid "By default the parser uses this function to report error messages:" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1265 #, no-wrap msgid "wisent-message" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1266 #, no-wrap msgid "wisent-message string &rest args" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1269 msgid "" "Print a one-line message if @code{wisent-parse-verbose-flag} is set. Pass " "@var{string} and @var{args} arguments to @dfn{message}." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1272 #, no-wrap msgid "Please Note:" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1275 msgid "@code{wisent-message} uses the following function to print lexical tokens:" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1276 #, no-wrap msgid "wisent-token-to-string token" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1278 msgid "Return a printed representation of lexical token @var{token}." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1281 msgid "The general printed form of a lexical token is:" msgstr "" #. type: code{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1283 msgid "@var{token}(@var{value})@@@var{location}" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1287 msgid "" "To control the verbosity of the parser you can set to non-@code{nil} this " "variable:" msgstr "" #. type: vindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1288 #, no-wrap msgid "wisent-parse-verbose-flag" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1289 #, no-wrap msgid "Option wisent-parse-verbose-flag" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1291 msgid "non-@code{nil} means to issue more messages while parsing." msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1295 #, no-wrap msgid "wisent-parse-toggle-verbose-flag" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1296 #, no-wrap msgid "Command wisent-parse-toggle-verbose-flag" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1298 msgid "Toggle whether to issue more messages while parsing." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1303 msgid "" "When the error reporting function is entered the variable " "@code{wisent-input} contains the unexpected token as returned by the lexer." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1308 msgid "" "The error reporting function can be called from a semantic action too using " "the special macro @code{wisent-error}. When called from a semantic action " "entered by error recovery (@pxref{Error recovery}) the value of the variable " "@code{wisent-recovering} is non-@code{nil}." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1309 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1310 #, no-wrap msgid "Error recovery" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1312 #, no-wrap msgid "error recovery" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1316 msgid "" "The error recovery mechanism of the Wisent's parser conforms to the one " "Bison uses. See @ref{Error Recovery, , , bison}, in the Bison manual for " "details." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1317 #, no-wrap msgid "error token" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1321 msgid "" "To recover from a syntax error you must write rules to recognize the special " "token @code{error}. This is a terminal symbol that is automatically defined " "and reserved for error handling." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1327 msgid "" "When the parser encounters a syntax error, it pops the state stack until it " "finds a state that allows shifting the @code{error} token. After it has " "been shifted, if the old look-ahead token is not acceptable to be shifted " "next, the parser reads tokens and discards them until it finds a token which " "is acceptable." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1328 #, no-wrap msgid "error recovery strategy" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1332 msgid "" "Strategies for error recovery depend on the choice of error rules in the " "grammar. A simple and useful strategy is simply to skip the rest of the " "current statement if an error is detected:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1337 #, no-wrap msgid "" "(statement (( error ?; )) ;; on error, skip until ';' is read\n" " )\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1342 msgid "" "It is also useful to recover to the matching close-delimiter of an " "opening-delimiter that has already been parsed:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1349 #, no-wrap msgid "" "(primary (( ?@{ expr ?@} ))\n" " (( ?@{ error ?@} ))\n" " @dots{}\n" " )\n" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1352 #, no-wrap msgid "error recovery actions" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1356 msgid "" "Note that error recovery rules may have actions, just as any other rules " "can. Here are some predefined hooks, variables, functions or macros, useful " "in such actions:" msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1357 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1358 #, no-wrap msgid "wisent-nerrs" msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1360 msgid "The number of parse errors encountered so far." msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1362 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1363 #, no-wrap msgid "wisent-recovering" msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1366 msgid "" "non-@code{nil} means that the parser is recovering. This variable only has " "meaning in the scope of @code{wisent-parse}." msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1368 #, no-wrap msgid "wisent-error" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1369 #, no-wrap msgid "wisent-error msg" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1372 msgid "" "Call the user supplied error reporting function with message @var{msg} " "(@pxref{Report errors})." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1374 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1390 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1407 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1423 msgid "For an example of use, @xref{wisent-skip-token}." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1376 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1377 #, no-wrap msgid "wisent-errok" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1380 msgid "Resume generating error messages immediately for subsequent syntax errors." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1384 msgid "" "The parser suppress error message for syntax errors that happens shortly " "after the first, until three consecutive input tokens have been successfully " "shifted." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1388 msgid "" "Calling @code{wisent-errok} in an action, make error messages resume " "immediately. No error messages will be suppressed if you call it in an " "error rule's action." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1392 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1393 #, no-wrap msgid "wisent-clearin" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1396 msgid "" "Discard the current lookahead token. This will cause a new lexical token to " "be read." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1399 msgid "" "In an error rule's action the previous lookahead token is reanalyzed " "immediately. @code{wisent-clearin} may be called to clear this token." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1405 msgid "" "For example, suppose that on a parse error, an error handling routine is " "called that advances the input stream to some point where parsing should " "once again commence. The next symbol returned by the lexical scanner is " "probably correct. The previous lookahead token ought to be discarded with " "@code{wisent-clearin}." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1409 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1410 #, no-wrap msgid "wisent-abort" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1412 msgid "Abort parsing and save the lookahead token." msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1414 #, no-wrap msgid "wisent-set-region" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1415 #, no-wrap msgid "wisent-set-region start end" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1421 msgid "" "Change the region of text matched by the current nonterminal. @var{start} " "and @var{end} are respectively the beginning and end positions of the region " "occupied by the group of components associated to this nonterminal. If " "@var{start} or @var{end} values are not a valid positions the region is set " "to @code{nil}." msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1425 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1426 #, no-wrap msgid "wisent-discarding-token-functions" msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1436 msgid "" "List of functions to be called when discarding a lexical token. These " "functions receive the lexical token discarded. When the parser encounters " "unexpected tokens, it can discards them, based on what directed by error " "recovery rules. Either when the parser reads tokens until one is found that " "can be shifted, or when an semantic action calls the function " "@code{wisent-skip-token} or @code{wisent-skip-block}. For language specific " "hooks, make sure you define this as a local hook." msgstr "" #. type: defvar #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1440 msgid "" "For example, in @semantic{}, this hook is set to the function " "@code{wisent-collect-unmatched-syntax} to collect unmatched lexical tokens " "(@pxref{Useful functions})." msgstr "" #. type: anchor{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1442 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1443 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1448 #, no-wrap msgid "wisent-skip-token" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1448 msgid "" "Skip the lookahead token in order to resume parsing. Return @code{nil}. " "Must be used in error recovery semantic actions." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1450 msgid "It typically looks like this:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1459 #, no-wrap msgid "" "(wisent-message \"%s: skip %s\" $action\n" " (wisent-token-to-string wisent-input))\n" "(run-hook-with-args\n" " 'wisent-discarding-token-functions wisent-input)\n" "(wisent-clearin)\n" "(wisent-errok)))\n" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1463 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1464 #, no-wrap msgid "wisent-skip-block" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1468 msgid "" "Safely skip a block in order to resume parsing. Return @code{nil}. Must be " "used in error recovery semantic actions." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1471 msgid "" "A block is data between an open-delimiter (syntax class @code{(}) and a " "matching close-delimiter (syntax class @code{)}):" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1477 #, no-wrap msgid "" "(a parenthesized block)\n" "[a block between brackets]\n" "@{a block between braces@}\n" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1484 msgid "" "The following example uses @code{wisent-skip-block} to safely skip a block " "delimited by @samp{LBRACE} (@code{@{}) and @samp{RBRACE} (@code{@}}) tokens, " "when a syntax error occurs in @samp{other-components}:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1492 #, no-wrap msgid "" "(block ((LBRACE other-components RBRACE))\n" " ((LBRACE RBRACE))\n" " ((LBRACE error)\n" " (wisent-skip-block))\n" " )\n" msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1497 #, no-wrap msgid "Debugging semantic actions" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1499 #, no-wrap msgid "semantic action symbols" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1504 msgid "" "Each semantic action is represented by a symbol interned in an @dfn{obarray} " "that is part of the @acronym{LALR(1)} automaton (@pxref{Compiling a " "grammar}). @code{symbol-function} on a semantic action symbol return the " "semantic action lambda expression." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1510 msgid "" "A semantic action symbol name has the form " "@code{@var{nonterminal}:@var{index}}, where @var{nonterminal} is the name of " "the nonterminal symbol the action belongs to, and @var{index} is an action " "sequence number within the scope of @var{nonterminal}. For example, this " "nonterminal definition:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1518 #, no-wrap msgid "" "input:\n" " line [@code{input:0}]\n" " | input line\n" " (format \"%s %s\" $1 $2) [@code{input:1}]\n" " ;\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1522 msgid "Will produce two semantic actions, and associated symbols:" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1524 #, no-wrap msgid "input:0" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1526 msgid "A default action that returns @code{$1}." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1527 #, no-wrap msgid "input:1" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1529 msgid "That returns @code{(format \"%s %s\" $1 $2)}." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1531 #, no-wrap msgid "debugging semantic actions" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1536 msgid "" "Debugging uses the Lisp debugger to investigate what is happening during " "execution of semantic actions. Three commands are available to debug " "semantic actions. They receive two arguments:" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1538 #, no-wrap msgid "The automaton that contains the semantic action." msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1540 #, no-wrap msgid "The semantic action symbol." msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1543 #, no-wrap msgid "wisent-debug-on-entry" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1544 #, no-wrap msgid "Command wisent-debug-on-entry automaton function" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1547 msgid "" "Request @var{automaton}'s @var{function} to invoke debugger each time it is " "called. @var{function} must be a semantic action symbol that exists in " "@var{automaton}." msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1549 #, no-wrap msgid "wisent-cancel-debug-on-entry" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1550 #, no-wrap msgid "Command wisent-cancel-debug-on-entry automaton function" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1553 msgid "" "Undo effect of @code{wisent-debug-on-entry} on @var{automaton}'s " "@var{function}. @var{function} must be a semantic action symbol that exists " "in @var{automaton}." msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1555 #, no-wrap msgid "wisent-debug-show-entry" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1556 #, no-wrap msgid "Command wisent-debug-show-entry automaton function" msgstr "" #. type: deffn #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1559 msgid "" "Show the source of @var{automaton}'s semantic action @var{function}. " "@var{function} must be a semantic action symbol that exists in " "@var{automaton}." msgstr "" #. type: node #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1561 #, no-wrap msgid "Wisent Semantic" msgstr "" #. type: chapter #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1562 #, no-wrap msgid "How to use Wisent with Semantic" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1564 #, no-wrap msgid "tags" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1567 msgid "" "This section presents how the Wisent's parser can be used to produce " "@dfn{tags} for the @semantic{} tool set." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1572 msgid "" "@semantic{} tags form a hierarchy of Emacs Lisp data structures that " "describes a program in a way independent of programming languages. Tags map " "program declarations, like functions, methods, variables, data types, " "classes, includes, grammar rules, etc.." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1573 #, no-wrap msgid "WY grammar format" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1577 msgid "" "To use the Wisent parser with @semantic{} you have to define your grammar in " "@dfn{WY} form, a grammar format very close to the one used by Bison." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1580 msgid "" "Please see @ref{top, Semantic Grammar Framework Manual,, grammar-fw}, for " "more information on @semantic{} grammars." msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1584 msgid "Grammar styles::" msgstr "" #. type: node #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1584 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1960 #, no-wrap msgid "Wisent Lex" msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1586 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1587 #, no-wrap msgid "Grammar styles" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1589 #, no-wrap msgid "grammar styles" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1595 msgid "" "@semantic{} parsing heavily depends on how you wrote the grammar. There are " "mainly two styles to write a Wisent's grammar intended to be used with the " "@semantic{} tool set: the @dfn{Iterative style} and the @dfn{Bison style}. " "Each one has pros and cons, and in certain cases it can be worth a mix of " "the two styles!" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1602 msgid "Iterative style::" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1602 msgid "Bison style::" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1602 msgid "Mixed style::" msgstr "" #. type: menuentry #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1602 msgid "Start nonterminals::" msgstr "" #. type: subsection #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1602 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1945 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1946 #, no-wrap msgid "Useful functions" msgstr "" #. type: subsection #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1604 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1605 #, no-wrap msgid "Iterative style" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1607 #, no-wrap msgid "grammar iterative style" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1612 msgid "" "The @dfn{iterative style} is the preferred style to use with @semantic{}. " "It relies on an iterative parser back-end mechanism which parses start " "nonterminals one at a time and automagically skips unexpected lexical tokens " "in input." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1616 msgid "" "Compared to rule-based iterative functions (@pxref{Bison style}), iterative " "parsers are better in that they can handle obscure errors more cleanly." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1617 #, no-wrap msgid "raw tag" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1621 msgid "" "Each start nonterminal must produces a @dfn{raw tag} by calling a " "@code{TAG}-like grammar macro with appropriate parameters. See also " "@ref{Start nonterminals}." msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1622 #, no-wrap msgid "expanded tag" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1626 msgid "" "Then, each parsing iteration automatically translates a raw tag into " "@dfn{expanded tags}, updating the raw tag structure with internal properties " "and buffer related data." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1628 msgid "After parsing completes, it results in a tree of expanded tags." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1632 msgid "" "The following example is a snippet of the iterative style Java grammar " "provided in the @semantic{} distribution in the file " "@file{semantic/wisent/java-tags.wy}." msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1643 #, no-wrap msgid "" "@dots{}\n" ";; Alternate entry points\n" ";; - Needed by partial re-parse\n" "%start formal_parameter\n" "@dots{}\n" ";; - Needed by EXPANDFULL clauses\n" "%start formal_parameters\n" "@dots{}\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1648 #, no-wrap msgid "" "formal_parameter_list\n" " : PAREN_BLOCK\n" " (EXPANDFULL $1 formal_parameters)\n" " ;\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1657 #, no-wrap msgid "" "formal_parameters\n" " : LPAREN\n" " ()\n" " | RPAREN\n" " ()\n" " | formal_parameter COMMA\n" " | formal_parameter RPAREN\n" " ;\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1662 #, no-wrap msgid "" "formal_parameter\n" " : formal_parameter_modifier_opt type variable_declarator_id\n" " (VARIABLE-TAG $3 $2 nil :typemodifiers $1)\n" " ;\n" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1665 #, no-wrap msgid "EXPANDFULL" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1672 msgid "" "It shows the use of the @code{EXPANDFULL} grammar macro to parse a " "@samp{PAREN_BLOCK} which contains a @samp{formal_parameter_list}. " "@code{EXPANDFULL} tells to recursively parse @samp{formal_parameters} inside " "@samp{PAREN_BLOCK}. The parser iterates until it digested all available " "input data inside the @samp{PAREN_BLOCK}, trying to match any of the " "@samp{formal_parameters} rules:" msgstr "" #. type: samp{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1674 #, no-wrap msgid "LPAREN" msgstr "" #. type: samp{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1676 #, no-wrap msgid "RPAREN" msgstr "" #. type: samp{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1678 #, no-wrap msgid "formal_parameter COMMA" msgstr "" #. type: samp{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1680 #, no-wrap msgid "formal_parameter RPAREN" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1687 msgid "" "At each iteration it will return a @samp{formal_parameter} raw tag, or " "@code{nil} to skip unwanted (single @samp{LPAREN} or @samp{RPAREN} for " "example) or unexpected input data. Those raw tags will be automatically " "expanded by the iterative back-end parser." msgstr "" #. type: subsection #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1688 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1689 #, no-wrap msgid "Bison style" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1691 #, no-wrap msgid "grammar bison style" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1699 msgid "" "What we call the @dfn{Bison style} is the traditional style of Bison's " "grammars. Compared to iterative style, it is not straightforward to use " "grammars written in Bison style in @semantic{}. Mainly because such " "grammars are designed to parse the whole input data in one pass, and don't " "use the iterative parser back-end mechanism (@pxref{Iterative style}). With " "Bison style the parser is called once to parse the grammar start " "nonterminal." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1703 msgid "" "The following example is a snippet of the Bison style Java grammar provided " "in the @semantic{} distribution in the file @file{semantic/wisent/java.wy}." msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1708 #, no-wrap msgid "" "%start formal_parameter\n" "@dots{}\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1715 #, no-wrap msgid "" "formal_parameter_list\n" " : formal_parameter_list COMMA formal_parameter\n" " (cons $3 $1)\n" " | formal_parameter\n" " (list $1)\n" " ;\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1722 #, no-wrap msgid "" "formal_parameter\n" " : formal_parameter_modifier_opt type variable_declarator_id\n" " (EXPANDTAG\n" " (VARIABLE-TAG $3 $2 :typemodifiers $1)\n" " )\n" " ;\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1729 msgid "" "The first consequence is that syntax errors are not automatically handled by " "@semantic{}. Thus, it is necessary to explicitly handle them at the grammar " "level, providing error recovery rules to skip unexpected input data." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1736 msgid "" "The second consequence is that the iterative parser can't do automatic tag " "expansion, except for the start nonterminal value. It is necessary to " "explicitly expand tags from concerned semantic actions by calling the " "grammar macro @code{EXPANDTAG} with a raw tag as parameter. See also " "@ref{Start nonterminals}, for incremental re-parse considerations." msgstr "" #. type: subsection #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1737 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1738 #, no-wrap msgid "Mixed style" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1740 #, no-wrap msgid "grammar mixed style" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1747 #, no-wrap msgid "" "%start grammar\n" ";; Reparse\n" "%start prologue epilogue declaration nonterminal rule\n" "@dots{}\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1758 #, no-wrap msgid "" "grammar:\n" " prologue\n" " | epilogue\n" " | declaration\n" " | nonterminal\n" " | PERCENT_PERCENT\n" " ;\n" "@dots{}\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1763 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1813 #, no-wrap msgid "" "nonterminal:\n" " SYMBOL COLON rules SEMI\n" " (TAG $1 'nonterminal :children $3)\n" " ;\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1768 #, no-wrap msgid "" "rules:\n" " lifo_rules\n" " (apply 'nconc (nreverse $1))\n" " ;\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1775 #, no-wrap msgid "" "lifo_rules:\n" " lifo_rules OR rule\n" " (cons $3 $1)\n" " | rule\n" " (list $1)\n" " ;\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1785 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1936 #, no-wrap msgid "" "rule:\n" " rhs\n" " (let* ((rhs $1)\n" " name type comps prec action elt)\n" " @dots{}\n" " (EXPANDTAG\n" " (TAG name 'rule :type type :value comps :prec prec :expr action)\n" " ))\n" " ;\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1792 msgid "" "This example shows how iterative and Bison styles can be combined in the " "same grammar to obtain a good compromise between grammar complexity and an " "efficient parsing strategy in an interactive environment." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1796 msgid "" "@samp{nonterminal} is parsed using iterative style via the main " "@samp{grammar} rule. The semantic action uses the @code{TAG} macro to " "produce a raw tag, automagically expanded by @semantic{}." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1798 msgid "But @samp{rules} part is parsed in Bison style! Why?" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1806 msgid "" "Rule delimiters are the colon (@code{:}), that follows the nonterminal name, " "and a final semicolon (@code{;}). Unfortunately these delimiters are not " "@code{open-paren}/@code{close-paren} type, and the Emacs' syntactic analyzer " "can't easily isolate data between them to produce a @samp{RULES_PART} " "parenthesis-block-like lexical token. Consequently it is not possible to " "use @code{EXPANDFULL} to iterate in @samp{RULES_PART}, like this:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1818 #, no-wrap msgid "" "rules:\n" " RULES_PART ;; @strong{Map a parenthesis-block-like lexical token}\n" " (EXPANDFULL $1 'rules)\n" " ;\n" "\n" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1834 #, no-wrap msgid "" "rules:\n" " COLON\n" " ()\n" " OR\n" " ()\n" " SEMI\n" " ()\n" " rhs\n" " rhs\n" " (let* ((rhs $1)\n" " name type comps prec action elt)\n" " @dots{}\n" " (TAG name 'rule :type type :value comps :prec prec :expr action)\n" " )\n" " ;\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1840 msgid "" "In such cases, when it is difficult for Emacs to obtain " "parenthesis-block-like lexical tokens, the best solution is to use the " "traditional Bison style with error recovery!" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1843 msgid "" "In some extreme cases, it can also be convenient to extend the lexer, to " "deliver new lexical tokens, to simplify the grammar." msgstr "" #. type: subsection #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1844 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1845 #, no-wrap msgid "Start nonterminals" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1847 #, no-wrap msgid "start nonterminals" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1848 #, no-wrap msgid "@code{reparse-symbol} property" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1853 msgid "" "When you write a grammar for @semantic{}, it is important to carefully " "indicate the start nonterminals. Each one defines an entry point in the " "grammar, and after parsing its semantic value is returned to the back-end " "iterative engine. Consequently:" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1856 msgid "" "@strong{The semantic value of a start nonterminal must be a produced by a " "TAG like grammar macro}." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1860 msgid "" "Start nonterminals are declared by @code{%start} statements. When nothing " "is specified the first nonterminal that appears in the grammar is the start " "nonterminal." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1863 msgid "Generally, the following nonterminals must be declared as start symbols:" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1865 #, no-wrap msgid "The main grammar entry point" msgstr "" #. type: quotation #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1868 msgid "Of course!" msgstr "" #. type: item #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1870 #, no-wrap msgid "nonterminals passed to @code{EXPAND}/@code{EXPANDFULL}" msgstr "" #. type: quotation #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1874 msgid "" "These grammar macros recursively parse a part of input data, based on rules " "of the given nonterminal." msgstr "" #. type: quotation #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1877 msgid "" "For example, the following will parse @samp{PAREN_BLOCK} data using the " "@samp{formal_parameters} rules:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1884 #, no-wrap msgid "" "formal_parameter_list\n" " : PAREN_BLOCK\n" " (EXPANDFULL $1 formal_parameters)\n" " ;\n" msgstr "" #. type: quotation #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1890 msgid "" "The semantic value of @samp{formal_parameters} becomes the value of the " "@code{EXPANDFULL} expression. It is a list of @semantic{} tags spliced in " "the tags tree." msgstr "" #. type: quotation #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1893 msgid "" "Because the automaton must know that @samp{formal_parameters} is a start " "symbol, you must declare it like this:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1897 #, no-wrap msgid "%start formal_parameters\n" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1902 #, no-wrap msgid "incremental re-parse" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1903 #, no-wrap msgid "reparse-symbol" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1909 msgid "" "The @code{EXPANDFULL} macro has a side effect it is important to know, " "related to the incremental re-parse mechanism of @semantic{}: the " "nonterminal symbol parameter passed to @code{EXPANDFULL} also becomes the " "@code{reparse-symbol} property of the tag returned by the @code{EXPANDFULL} " "expression." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1913 msgid "" "When buffer's data mapped by a tag is modified, @semantic{} schedules an " "incremental re-parse of that data, using the tag's @code{reparse-symbol} " "property as start nonterminal." msgstr "" #. type: strong{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1916 msgid "" "The rules associated to such start symbols must be carefully reviewed to " "ensure that the incremental parser will work!" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1919 msgid "" "Things are a little bit different when the grammar is written in Bison " "style." msgstr "" #. type: strong{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1922 msgid "" "The @code{reparse-symbol} property is set to the nonterminal symbol the rule " "that explicitly uses @code{EXPANDTAG} belongs to." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1924 msgid "For example:" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1941 msgid "" "Set the @code{reparse-symbol} property of the expanded tag to @samp{rule}. " "An important consequence is that:" msgstr "" #. type: strong{#1} #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1944 msgid "" "Every nonterminal having any rule that calls @code{EXPANDTAG} in a semantic " "action, should be declared as a start symbol!" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1950 msgid "" "Here is a description of some predefined functions it might be useful to " "know when writing new code to use Wisent in @semantic{}:" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1951 #, no-wrap msgid "wisent-collect-unmatched-syntax" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1952 #, no-wrap msgid "wisent-collect-unmatched-syntax input" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1955 msgid "" "Add @var{input} lexical token to the cache of unmatched tokens, in variable " "@code{semantic-unmatched-syntax-cache}." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1958 msgid "" "See implementation of the function @code{wisent-skip-token} in @ref{Error " "recovery}, for an example of use." msgstr "" #. type: section #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1961 #, no-wrap msgid "The Wisent Lex lexer" msgstr "" #. type: findex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1963 #, no-wrap msgid "semantic-lex" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1967 msgid "" "The lexical analysis step of @semantic{} is performed by the general " "function @code{semantic-lex}. For more information, see @ref{Writing " "Lexers, Semantic Language Development,,semantic-langdev}." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1969 msgid "@code{semantic-lex} produces lexical tokens of the form:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1973 #, no-wrap msgid "@code{(@var{token-class start} . @var{end})}\n" msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1980 msgid "" "Is a symbol that identifies a lexical token class, like @code{symbol}, " "@code{string}, @code{number}, or @code{PAREN_BLOCK}." msgstr "" #. type: table #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1984 msgid "Are the start and end positions of mapped data in the input buffer." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1989 msgid "" "The Wisent's parser doesn't depend on the nature of analyzed input stream " "(buffer, string, etc.), and requires that lexical tokens have a different " "form (@pxref{Writing a lexer}):" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1993 #, no-wrap msgid "@code{(@var{token-class value} [@var{start} . @var{end}])}\n" msgstr "" #. type: cindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1996 #, no-wrap msgid "lexical token mapping" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1998 msgid "@code{wisent-lex} is the default Wisent's lexer used in @semantic{}." msgstr "" #. type: vindex #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:1999 #, no-wrap msgid "wisent-lex-istream" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:2000 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:2001 #, no-wrap msgid "wisent-lex" msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:2003 msgid "Return the next available lexical token in Wisent's form." msgstr "" #. type: defun #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:2007 msgid "" "The variable @code{wisent-lex-istream} contains the list of lexical tokens " "produced by @code{semantic-lex}. Pop the next token available and convert " "it to a form suitable for the Wisent's parser." msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:2011 msgid "" "Mapping of lexical tokens as produced by @code{semantic-lex} into equivalent " "Wisent lexical tokens is straightforward:" msgstr "" #. type: group #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:2016 #, no-wrap msgid "" "(@var{token-class start} . @var{end})\n" " @result{} (@var{token-class value start} . @var{end})\n" msgstr "" #. type: Plain text #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:2021 msgid "" "@var{value} is the input @code{buffer-substring} from @var{start} to " "@var{end}." msgstr "" #. type: appendix #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:2022 #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:2023 #, no-wrap msgid "GNU Free Documentation License" msgstr "" #. type: include #: /Users/suzume/Documents/Repositories/Projet OmegaT de Documentation Emacs - #: Sources/doc/misc/wisent.texi:2025 #, no-wrap msgid "doclicense.texi" msgstr ""