1

我正在使用此处描述的语法为 PowerShell 语言编写解析器:http: //www.microsoft.com/en-us/download/details.aspx?id=9706

我使用了 Irony,Irony Grammar Explorer 报告了一些 shift/reduce 和 reduce/reduce 错误。这把我难住了,因为我不确定它在告诉我什么。

状态 S79(不足)
  输入上的 Shift-reduce 冲突: [ , + dash ++ dashdash
  移位项目:
    cast_expression -> type_literal ·unary_expression
    unary_expression -> ·primary_expression
    primary_expression -> ·value
    值 -> ·圆括号表达式
    括号表达式 -> ·(管道)
    值 -> ·sub_expression
    sub_expression -> ·$( statement_list_opt )
    值 -> ·array_expression
    array_expression -> ·@( statement_list_opt )
    值 -> ·script_block_expression
    script_block_expression -> ·{ script_block }
    值 -> ·hash_literal_expression
    hash_literal_expression -> ·@{ hash_literal_body_opt }
    值 -> ·文字
    文字 -> ·integer_literal
    integer_literal -> ·decimal_integer_literal
    integer_literal -> ·hexadecimal_integer_literal
    文字 -> ·real_literal
    文字 -> ·string_literal
    string_literal -> ·expandable_string_literal
    string_literal -> ·verbatim_string_literal
    值 -> ·type_literal
    type_literal -> ·[ type_spec ]
    值 -> ·变量
    primary_expression -> ·member_access
    member_access -> ·primary_expression Unnamed6 member_name
    primary_expression -> ·element_access
    element_access -> ·primary_expression [表达式]
    primary_expression -> ·post_increment_expression
    post_increment_expression -> ·primary_expression ++
    primary_expression -> ·post_decrement_expression
    post_decrement_expression -> ·primary_expression 破折号
    unary_expression -> ·expression_with_unary_operator
    expression_with_unary_operator -> ·, unary_expression
    expression_with_unary_operator -> ·-not unary_expression
    expression_with_unary_operator -> ·!一元表达式
    expression_with_unary_operator -> ·-bnot unary_expression
    expression_with_unary_operator -> ·+ unary_expression
    expression_with_unary_operator -> ·dash unary_expression
    expression_with_unary_operator -> ·pre_increment_expression
    pre_increment_expression -> ·++ unary_expression
    expression_with_unary_operator -> ·pre_decrement_expression
    pre_decrement_expression -> ·dashdash unary_expression
    expression_with_unary_operator -> ·cast_expression
    cast_expression -> ·type_literal 一元表达式
    expression_with_unary_operator -> ·-拆分一元表达式
    expression_with_unary_operator -> ·-join unary_expression
  减少项目:
    值-> type_literal · [assignment_operator 。:: [ ++ dashdash , .. format_operator * / % + dash as ccontains ceq cge cgt cle clike clt cmatch cne cnotcontains cnotlike cnotmatch contains creplace csplit eq ge gt icontains ieq ige igt ile ilike ilt imatch ine inotcontains inotlike inotmatch ireplace is not isplit join le like lt match ne notcontains notlike notmatch replace split -band -bor -bxor -and -or -xor 2>&1 1>&2 file_redirection_operator | ; new_line_character EOF } ) = ]]
  转换:unary_expression->S187, primary_expression->S158, value->S60, parenthesized_expression->S61, (->S62, sub_expression->S63, $(->S64, array_expression->S65, @(->S66, script_block_expression ->S67, {->S68, hash_literal_expression->S69, @{->S70, literal->S71, integer_literal->S72, decimal_integer_literal->S73, hexadecimal_integer_literal->S74, real_literal->S75, string_literal->S76, expandable_string_literal->S77, verbatim_string_literal->S78, type_literal->S79, [->S80, variable->S81, member_access->S82, element_access->S83, post_increment_expression->S84, post_decrement_expression->S85, expression_with_unary_operator->S97, ,->S98, -not->S99, !->S100, -bnot->S101, +->S102, 破折号->S103, pre_increment_expression->S104, ++->S105,pre_decrement_expression->S106,dashdash->S107,cast_expression->S108,-split->S109,-join->S110

如果你想看看自己,代码在这里:https ://github.com/Pash-Project/Pash/tree/method-invocation/Source/Pash.System.Management

编辑:我认为这让人困惑的输入是:

[int] +7

这是添加还是铸造?

4

0 回答 0