首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到19条相似文献,搜索用时 125 毫秒
1.
用YACC实现基于词性标记文法的文本信息隐藏   总被引:1,自引:0,他引:1  
将词性标记文法语言作自然语言的变换域,分别使用分词与词性标记软件和模拟函数将载体文本与秘密信息都变换到该域;运用字符串匹配技术计算秘密信息句子在载体文本中的位置,位置即为密钥;接收方根据密钥提取文法的句子,再通过语法分析的规约动作读出秘密信息,语法分析程序可利用YACC自动生成。该算法不改变载体文本,能较好地解决Wayner的载体文本生成技术面临的载体文本符合语法但不符合语义的问题。  相似文献   

2.
在分析正规式、正规文法和上下文无关文法的基础上,着重讨论上下文无关文法中涉及到的一些重要的文法,例如二义文法、递归文法、LL(1)文法、LR(0)文法和SLR(1)文法,并以二义文法为主线,分析二义文法和递归文法、LL(1)文法、LR(0)文法和SLR(1)文法的关系,找出一些判定文法有无二义性的充分条件。  相似文献   

3.
岳小婷 《福建电脑》2011,27(10):204-206
本文将案例法引入了《编译原理》课程的教学,发挥案例法的优势,以二义文法为主线,探讨了二义文法和递归文法、LL(1)文法、LR(0)文法和SLR(1)文法的关系,找出了一些判定文法有无二义性的充分条件,同时研究了解决二义性的方法,加深了学生对二义文法的理解。  相似文献   

4.
讨论了XML解析器的C++实现以及对应的DOM接口,其主要任务是为应用程序提供一个简洁、高速、低内存消耗的XML解析接口,并在保证性能的前提下提供尽可能多的DOM支持。讨论了一个解析器的模型,以及如何用LEX和YACC来实现这个解析器及DOMLevel 1Core的C++实现和与解析器的配合问题。  相似文献   

5.
随着计算机科学领域智能化要求的提高,文法分析也需要提供更强壮的功能,要求能对二义文法提供可靠分析。该文提出了一种基于数学表达式的二义文法分析算法,很好地判别了某些数学表达式的正确性。  相似文献   

6.
介绍一种利用YACC(Yet Another Compiler-Compiler)技术实现检测网络服务器程序异常行为的新方法。该方法用一种携带语义标注的上下文无关文法描述服务器程序正常行为模式,利用YACC自动生成的语法分析器构成异常检测引擎,并利用YACC提供的错误处理和语义处理接口对异常现场进行分析。实验结果表明,该方法不仅能有效检测各种利用服务器程序漏洞进行的缓冲区溢出、堆内存破环等入侵方式,而且能实时地对异常行为进行分析追踪并向安全管理人员提供入侵相关详细信息,而这种能力正是目前同类方法所缺乏的。  相似文献   

7.
自然语言解析器是一个制定语法结构句子的程序。概率解析器使用语言知识获得hand-parsed句子来产生最可能的分析新句子。斯坦福大学的自然语言解析器是一个实现英语、德语、汉语、阿拉伯语概率PCFG和依存解析器。链接语法解析器是根据链接文法和英语语法理论的一个英语语法解析器(包括其他语言)。PC-PATR是一个语法解析器,使用PARTII作为一项规则描述语言。这是一个实现了PARTII形式主义计算语言。  相似文献   

8.
研究了如何用CONPAR语言对Petri网图形进行描述,来获得Petri网模型对应的等效文本文件;然后设计了由Petri网文本文件到VHDL转换的文法规则及对应的语义动作源文件,并由编译工具YACC自动生成Petri网到VHDL转换的语法分析器;语法分析生成的中间代码是一棵抽象语法树,可以自顶向下遍历此抽象语法树,并按照相应的语义规则,通过比较Petri网文本描述和VHDL代码的差别生成VHDL目标代码;由此实现了Petri网到VHDL的翻译器,为基于Petri网的并行控制器的自动硬件实现提供了一种快速有效的方法。  相似文献   

9.
软件体系结构的属性图文法描述及其约束验证*   总被引:5,自引:0,他引:5  
在前人工作的基础上,使用了一种利于约束检查和属性刻画的属性图文法,该方法形式地描述了体系结构及其演化;接着给出了一个算法检查演化动作是否会破坏体系结构约束.在对属性图文法系统AGG的图形解析器进行定制和改进的基础上,设计并实现了体系结构自动检查器.该检查器已应用于面向体系结构的服务集成开发平台Artemis-ARC系统中.  相似文献   

10.
面向中文短信的信息抽取方法   总被引:1,自引:0,他引:1       下载免费PDF全文
在手机3D动画自动生成系统中,研究面向中文短信的信息抽取方法.设计一种基于上下文无关文法的模板定义方式,以及对应的模板知识库与模板解析器.在模板解析器处理数据的过程中,通过最左规约算法保证中文短信的信息抽取效率.实验结果表明,该方法在扩展抽取内容范围的同时,能提高信息抽取的准确性.  相似文献   

11.
Thomas R. Kramer 《Software》2010,40(5):387-404
A method is described for repairing some shift/reduce conflicts caused by limited lookahead in LALR(1) parsers such as those built by bison. Also, six types of Extended BNF (EBNF) construct are identified that cause a shift/reduce conflict when a Yet Another Compiler Compiler (YACC) file translated directly from EBNF is processed by bison. For each type, a replacement EBNF construct is described representing the same grammar and causing no shift/reduce conflict when its YACC equivalent is processed by bison. Algorithms are given for identifying instances of each type and transforming them into their replacements. The algorithms are implemented in an automatic parser builder that builds parsers for subsets of the DMIS language. The parser builder reads an EBNF file and writes C++ classes, a YACC file, and a Lex file, which are then processed to build a parser. The parsers build a parse tree using the C++ classes. The EBNF for DMIS is written in natural terms so that natural C++ classes are generated. However, if translated directly into YACC, the natural EBNF leads to 22 shift/reduce conflicts that fall into the six types. The parser builder recognizes the six constructs and replaces them automatically before generating YACC. The YACC that is generated parses in terms of unnatural constructs while building a parse tree using natural C++ classes. The six types of construct may occur in any statement‐based language that uses a minor separator, such as a comma; hence knowing how to recognize and replace them may be broadly useful. Published in 2010 by John Wiley & Sons, Ltd.  相似文献   

12.
13.
利用YAY最终解决VHDL中歧义文法问题的方案   总被引:3,自引:0,他引:3  
提出了一种使用新的编译器产生工具YAY来编写VHDL语法分析器的方法,实践表明,用这种方法设计的语法分析器完全解决了VHDL中歧义文法的问题而且其对应的代码效率较高,可读性较好。  相似文献   

14.
Visual YACC is a tool that automatically creates visualizations of the YACC LR parsing process and synthesized attribute computation. The Visual YACC tool works by instrumenting a standard YACC grammar with graphics calls that draw the appropriate data structures given the current actions by the parser. The new grammar is processed by the YACC tools and the resulting parser displays the parse stack and parse tree for every step of the parsing process of a given input string. Visual YACC was initially designed to be used in compiler construction courses to supplement the teaching of parsing and syntax directed evaluation. We have also found it to be useful in the difficult task of debugging YACC grammars. In this paper, we describe this tool and how it is used in both contexts. We also detail two different implementations of this tool: one that produces a parser written in C with calls to Motif; and a second implementation that generates Java source code. Copyright © 1999 John Wiley & Sons, Ltd.  相似文献   

15.
A wide range of parser generators are used to generate parsers for programming languages. The grammar formalisms that come with parser generators provide different approaches for defining operator precedence. Some generators (e.g. YACC) support precedence declarations, others require the grammar to be unambiguous, thus encoding the precedence rules. Even if the grammar formalism provides precedence rules, a particular grammar might not use it. The result is grammar variants implementing the same language. For the C language, the GNU Compiler uses YACC with precedence rules, the C-Transformers uses SDF without priorities, while the SDF library does use priorities. For PHP, Zend uses YACC with precedence rules, whereas PHP-front uses SDF with priority and associativity declarations.The variance between grammars raises the question if the precedence rules of one grammar are compatible with those of another. This is usually not obvious, since some languages have complex precedence rules. Also, for some parser generators the semantics of precedence rules is defined operationally, which makes it hard to reason about their effect on the defined language. We present a method and tool for comparing the precedence rules of different grammars and parser generators. Although it is undecidable whether two grammars define the same language, this tool provides support for comparing and recovering precedence rules, which is especially useful for reliable migration of a grammar from one grammar formalism to another. We evaluate our method by the application to non-trivial mainstream programming languages, such as PHP and C.  相似文献   

16.
论文对在设计ATLAS-C语法分析器中YACC工具所无法解决的冲突进行了具体的讨论与研究,并且对出现的冲突提出了相应的解决方案。实验结果证明论文提出的消解冲突的方法在设计语法分析器时具有可行性。  相似文献   

17.
The context-free grammars and parsers conventionally used to define and interpret concrete syntax lead to constrained expression notations. This paper gives algorithms which support less constrained, more intuitive notations. These algorithms can be viewed as context-sensitive parsers, where the context that is taken into account is the type structure of the expression. Or they can be viewed as type checkers that determine the form of the abstract syntax. The approach taken seamlessly integrates parsing and type-checking in the formalism of Markov algorithms. The interpretation of concrete syntax by these algorithms is unambiguous. At least one algorithm, DMA-T, is practical; its worst case time is 0(tn2) where n is the length of the expression and t is the maximum length of any type expression.  相似文献   

18.
We present a technique for implementing visual language compilers through standard compiler generation platforms. The technique exploits eXtended Positional Grammars (XPGs, for short) for modeling the visual languages in a natural way, and uses a set of mapping rules to translate an XPG specification into a translation schema. This lets us generate visual language parsers through standard compiler–compiler techniques and tools like YACC. The generated parser accepts exactly the same set of visual sentences derivable through the application of XPG productions. The technique represents an important achievement, since it enables us to perform visual language compiler construction through standard compiler–compilers rather than specific compiler generation tools. This makes our approach particularly appealing, since compiler–compilers are widely used and rely on a well-founded theory. Moreover, the approach provides the basis for the unification of traditional textual language technologies and visual language compiler technologies.  相似文献   

19.
LL(1) grammars have the conceptual and practical advantage that they allow the compiler writer to view the grammar as a program; this allows a more natural positioning of semantic actions and a simple attribute mechanism. Resulting parsers can be constructed that achieve fully automatic error-recovery, which allows the compiler writer to ignore totally the issue of syntax errors. Measurement shows that such parsers can be reasonably efficient.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号