MetaLexer: a modular lexical specification language

Andrew Casey, L. Hendren
{"title":"MetaLexer: a modular lexical specification language","authors":"Andrew Casey, L. Hendren","doi":"10.1145/1960275.1960279","DOIUrl":null,"url":null,"abstract":"Compiler toolkits make it possible to rapidly develop compilers and translators for new programming languages. Although there exist elegant toolkits for modular and extensible parsers, compiler developers must often resort to ad-hoc solutions when extending or composing lexers. This paper presents MetaLexer, a new modular lexical specification language and associated tool.\n MetaLexer allows programmers to define lexers in a modular fashion. MetaLexer modules can be used to break the lexical specification of a language into a collection smaller modular lexical specifications. Control is passed between the modules using the concept of meta-tokens and meta-lexing. MetaLexer modules are also extensible.\n MetaLexer has two key features: it abstracts lexical state transitions out of semantic actions and it makes modules extensible by introducing multiple inheritance.\n We have constructed a MetaLexer tool which converts MetaLexer specifications to the popular JFlex lexical specification language and we have used our tool to create lexers for three real programming languages and their extensions: AspectJ (and two AspectJ extensions), MATLAB (and the AspectMatlab extension), and MetaLexer itself. The new specifications are easier to read, are extensible, and require much less action code than the originals.","PeriodicalId":353153,"journal":{"name":"Aspect-Oriented Software Development","volume":"1 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2011-03-21","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"7","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Aspect-Oriented Software Development","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/1960275.1960279","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 7

Abstract

Compiler toolkits make it possible to rapidly develop compilers and translators for new programming languages. Although there exist elegant toolkits for modular and extensible parsers, compiler developers must often resort to ad-hoc solutions when extending or composing lexers. This paper presents MetaLexer, a new modular lexical specification language and associated tool. MetaLexer allows programmers to define lexers in a modular fashion. MetaLexer modules can be used to break the lexical specification of a language into a collection smaller modular lexical specifications. Control is passed between the modules using the concept of meta-tokens and meta-lexing. MetaLexer modules are also extensible. MetaLexer has two key features: it abstracts lexical state transitions out of semantic actions and it makes modules extensible by introducing multiple inheritance. We have constructed a MetaLexer tool which converts MetaLexer specifications to the popular JFlex lexical specification language and we have used our tool to create lexers for three real programming languages and their extensions: AspectJ (and two AspectJ extensions), MATLAB (and the AspectMatlab extension), and MetaLexer itself. The new specifications are easier to read, are extensible, and require much less action code than the originals.
MetaLexer:一种模块化的词汇规范语言
编译器工具包使得为新的编程语言快速开发编译器和翻译器成为可能。尽管存在用于模块化和可扩展解析器的优雅工具包,但编译器开发人员在扩展或组合词法分析器时必须经常求助于特别的解决方案。本文介绍了一种新的模块化词汇规范语言MetaLexer及其相关工具。MetaLexer允许程序员以模块化的方式定义词法分析器。MetaLexer模块可用于将语言的词法规范分解为更小的模块化词法规范集合。使用元令牌和元词法的概念在模块之间传递控制。MetaLexer模块也是可扩展的。MetaLexer有两个关键特性:它从语义动作中抽象出词法状态转换,并通过引入多重继承使模块具有可扩展性。我们已经构建了一个MetaLexer工具,它将MetaLexer规范转换为流行的JFlex词法规范语言,并且我们已经使用该工具为三种真正的编程语言及其扩展创建了词法分析器:AspectJ(和两个AspectJ扩展)、MATLAB(和AspectMatlab扩展)和MetaLexer本身。新的规范更容易阅读,可扩展,并且比原始规范需要更少的操作代码。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信