用于 Sparrow DSL 的 LLM 生成的解析器和合规性检查器
2 分•作者: melezhik•2 个月前
您好,
我认为 LLM 在生成 DSL 代码方面非常出色,前提是提供结构良好且清晰的提示。
我是 Sparrow(https://github.com/melezhik/Sparrow6/blob/master/documentation/taskchecks.md)的作者,这是一个用于文本解析和自动化的 DSL,拥有多种编程语言的 SDK。我对 DeepSeek 生成不同配置文件的解析器和合规性检查器(例如 sudoers、sshd、redis、forgejo 等)的表现印象深刻。以下是一些示例:
* forgejo - https://chat.deepseek.com/share/y3f2om2b6hvzcm752h
* redis - https://chat.deepseek.com/share/9eakpdlaa6b88e38u3
* sshd - https://chat.deepseek.com/share/1roo31ihmuz10xjxem
* sudoers - https://chat.deepseek.com/share/is2ey6vgbhvdbyqtoa
以下是我使用的两个提示:
* 使用 Python SDK - https://gist.github.com/melezhik/d57132c9d3ba0ae9cee30a7c04c98399
* 使用 Raku SDK - https://gist.github.com/melezhik/6f25775aab9f5ec2e22f1193e7ca824b
您可以选择其中任何一个,将 sshd/forgejo 替换为您感兴趣的任何词,并使用免费的 DeepSeek 聊天机器人(专家级别,带浏览器)进行尝试,祝您玩得开心!
PS:您最好尝试 Raku SDK 提示,因为它也能处理带有逻辑分组(ini 风格)的配置文件,但您也可以通过从 Raku 提示中借鉴措辞来轻松修改 Python 提示。
查看原文
Hi<p>I believe LLM are really cool in generating DSL code. If one provides well structured and clear prompt.<p>I am the author of Sparrow ( https://github.com/melezhik/Sparrow6/blob/master/documentation/taskchecks.md ) DSL for text parsing and automation with SDK for many programming languages , and I am really impressed how well deep seek generates parsers and compliance checkers for different configuration files - sudoers, sshd, redis, forgejo to name a few. Here are just some examples:<p>- forgejo - https://chat.deepseek.com/share/y3f2om2b6hvzcm752h<p>- redis - https://chat.deepseek.com/share/9eakpdlaa6b88e38u3<p>- sshd - https://chat.deepseek.com/share/1roo31ihmuz10xjxem<p>- sudoers - https://chat.deepseek.com/share/is2ey6vgbhvdbyqtoa<p>Here are two prompts I use :<p>- With Python SDK - https://gist.github.com/melezhik/d57132c9d3ba0ae9cee30a7c04c98399
- With Raku SDK - https://gist.github.com/melezhik/6f25775aab9f5ec2e22f1193e7ca824b<p>You may choose any of them replace words sshd/forgejo by any word of your interest and try it out with free deep seek chat bot, expert level with browser, have fun<p>PS you’d better try Raku SDK prompt as it handles configuration files with logical groups ( ini style ) as well , but you can easily modify the Python one by stealing the phrasing from Raku prompt