我正在努力理解 yacc 递归。所以我创建了一种最小的语言,我想简单地回显给它的数字列表。我正在使用 JISON。这是吉森:
/* description: Parses end executes mathematical expressions. */
/* lexical grammar */
%lex
%%
\s+ /* skip whitespace */
[0-9]+("."[0-9]+)?\b return 'NUMBER'
<<EOF>> return 'EOF'
. return 'INVALID'
/lex
%start expressions
%% /* language grammar */
expressions
: e EOF
{}
;
e
: NUMBER {}
| NUMBER e
;
我需要什么操作来回显以空格分隔的数字列表?