We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
要把bnf解析为jsbison能使用的json格式的上下文无关文法。。
如:
%start expr %% expr : expr '+' term { this.$$ = $1 + $2; } | term { this.$$ = $1; } ; term : term '*' factoy { this.$$ = $1 * $2; } | factoy { this.$$ = $1; } ; factoy : NUMBER { this.$$ = parseInt($1, 10); } | '(' expr ')' { this.$$ = $2; } ;
转换为:
{ tokens: '+ * ( ) NUMBER', start: 'expr', bnf: { 'expr': { 'expr + term': 'this.$$ = $1 + $3', 'term': 'this.$$ = $1' }, 'term': { 'term * factor': 'this.$$ = $1 * $3', 'factor': 'this.$$ = $1' }, 'factor': { 'NUMBER': 'this.$$ = parseInt($1, 10)', '( expr )': 'this.$$ = $2' } } }
jsbison的bnf2cfg,所能解析的bnf文件中支持的功能:
The text was updated successfully, but these errors were encountered:
acodercc
No branches or pull requests
要把bnf解析为jsbison能使用的json格式的上下文无关文法。。
如:
转换为:
jsbison的bnf2cfg,所能解析的bnf文件中支持的功能:
The text was updated successfully, but these errors were encountered: