Programmatic approach — a specific parser program is written to parse each message format.
编程方法——编写特定的解析器程序来解析每种消息格式。
Compile and run the sample parser program ccalc with the following input (which includes a slight typo).
使用下面的输入(其中稍微进行了排版)来编译并运行这个示例解析器程序ccalc。
This is because we decided to explicitly permit the use of the Bison standard parser program in Bison output files without restriction.
这是因为我们决定明确允许使用Bison输出文件中的标准语法分析程序是不受限制的。
Some programs copy parts of themselves into the output for technical reasons — for example, Bison copies a standard parser program into its output file.
一些程序会由于技术原因而拷贝他们的某部分到输出——例如,Bison拷贝一个标准的语法分析程序到它的输出文件。
Descriptive approach — You write a single general-purpose model-driven parser program to parse all formats, with each message format represented by its own model.
描述方法——您将编写单个通用的模型驱动的解析器程序来解析所有格式,每种消息格式由各自的模型表示。
For example, if you have five different COBOL data structures, you write five format-specific parsers, with the format information hard-wired into the parser program code.
例如,如果您有五种不同的COBOL数据结构,您将编写五个特定于格式的解析器,并将格式信息硬编码到解析器程序代码中。
The disadvantage is lack of flexibility -- you must write a new parser program for each new format, and if a format changes, you must change, recompile, relink, and redeploy the parser program.
缺点在于缺乏灵活性——您必须为每种新的格式编写新的解析器程序,并且如果格式更改,您就必须更改、重新编译、重新链接和重新部署解析器程序。
You can compile and "run" this program to see if your parser operates correctly before moving on to step 5.
在进行到步骤5之前,您可以编译并“运行”该程序以查看您的解析器运作是否正确。
In this program, the parser USES global variables to track the list of messages parsed.
在这个程序中,解析器使用全局变量来追踪解析的消息列表。
Some simple programs can get by on almost no additional code; others use a parser as a tiny portion of a much larger and more complicated program.
一些简单的程序可以不依赖于任何另外的代码;在一些更大更复杂的程序中,解析器只是很小的一部分。
For instance, in the case of the simple line-counting program, there's no real need for a parser.
例如,在那个简单的行计数程序的例子中,实际上不需要解析器。
The use of XSL separates the page layout from the program data, so you don't need to write or use an XML parser because XSL does it for you.
XSL的使用将页面布局与程序数据分隔开,因此您不必编写或使用XML解析器,因为 XSL 替您这样做了。
While the rest of the program is pretty much just boilerplate code to get the SAX2 parser running, the part in Listing 7 defines the application's personality.
虽然程序其他部分只是让SAX2解析器运行的样板代码,但是清单7中的部分定义了应用程序的个性。
As a reminder: the Reader is basically Clojure's parser; it turns a textual representation of a Clojure program into Clojure data structures, which can then be evaluated.
说明一下,Reader基本上是个Clojure解析器;它会将文本形式的Clojure程序转换为Clojure数据结构,然后再对该数据结构求值。
The third production of program lets the parser go past an error, search for a semicolon, and continue afterwards (normally an error would be fatal to the parser).
program的第三个输出让这个分析程序可以获得错误,从中搜索分号,然后继续执行(通常错误对于解析器来说都是非常严重的)。
The third production of program lets the parser go past an error, search for a semicolon, and continue afterwards (normally an error would be fatal to the parser).
program的第三个输出让这个分析程序可以获得错误,从中搜索分号,然后继续执行(通常错误对于解析器来说都是非常严重的)。
应用推荐