问题描述
3年来,我一直在使用模板工具包来扩展现有的领域特定语言(verilog).虽然总体上我对此感到满意,但主要的刺激因素是,当出现语法错误/undef错误时,错误消息中没有包含用于调试错误的正确行号信息.
I have been using template toolkit for extending an existing domain specific language(verilog) for over 3 years now. While overall I am happy with it, the major irritant is that when there is a syntax/undef error the error message does not contain the correct line number information to debug the error.
例如我将收到一条指示未定义0"的消息,因为我将在文件的多个位置使用[%x.0%]和类似的构造,弄清楚哪一行出现了问题变得很困难.
e.g. I would get a message indicating "0 is not defined" since I would be using [%x.0%] and similar constructs at multiple locations in the file figuring out which line has the problem becomes difficult.
TT3似乎正在无限开发中
TT3 seems to be under development indefinitely
我向大师提出的问题是,有没有比TT更好的选择.我的要求是
My question to the gurus is is there a better alternative to TT. My requirements are
- 支持复杂的数据结构
- 良好的错误报告和调试功能.
- 稳定且经过验证(没有alpha/beta级引擎)
- 可扩展(插件等)
- 不应仅限于给定的语言(例如html等)
- 支持IF/Else,循环(foreach while),循环索引等.
- 最好是perl
- 在模板中对数据转储或等效插件的支持是一个加
推荐答案
我目前正在尝试模板:: Alloy ,并且在很大程度上似乎可以替代TT. Template :: Alloy :: TT 列出了TT和Alloy之间的差异,大部分其格式为在Alloy中允许/允许使用,但在TT中不允许."为解决您的特定问题,该列表包括:
I'm currently experimenting with Template::Alloy and it seems to be, by and large, a drop-in replacement for TT. Template::Alloy::TT lists the differences between TT and Alloy, most of which are of the form "This works/is allowed in Alloy, but not in TT." Addressing your specific issue, the list includes:
当打开调试目录时,在不同行上的指令以逗号分隔 冒号显示的是它们所在的行,而不是一般的行范围.
When debug dirs is on, directives on different lines separated by colons show the line they are on rather than a general line range.
解析错误实际上知道它们发生在什么行和字符上.
Parse errors actually know what line and character they occured at.
这篇关于Perl:模板工具包的替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!