-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
脚本支持多语言(python、sql)模式开发 #10
Labels
feature
新特性
Comments
上面的需求需要在一门脚本语言上支持多种语言开发。我们可以参考 %python
a=1
print(1)
% 对于支持jdbc协议( %sql(test)
select 1 from test;
% > output 值得关注
|
bebee4java
added
enhancement
New feature or request
feature
新特性
and removed
enhancement
New feature or request
labels
Feb 1, 2021
我们通过antlr lexical modes找到解决方法,antler的词法分析模式允许在同份文件中包含多重语言。通过一些特殊的"哨兵"字符序列,执行不同模式的切换,参考文档。 我们的实现差不多像这样: lexer grammar IdesLexer;
...
PY_MODE : '%python' -> pushMode(PYTHON_LAN);
SQL_MODE : '%sql' -> pushMode(SQL_LAN);
...
mode PYTHON_LAN;
EXIT_PY : '%' -> popMode;
IGNORE_PY : . -> more ;
...
mode SQL_LAN;
EXIT_SQL : '%' -> popMode;
IGNORE_SQL : . -> more ;
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ides自定义了一整套dsl,如(load/save/set/connect...)等语法,具体参考。
我们希望从语法层原生支持
sql
、python
等语言的执行,这样可以丰富脚本开发,因为很有可能某些同学习惯使用sql
或python
进行数据处理(算法同学同样需要python
加持)。The text was updated successfully, but these errors were encountered: