我正在编写PowerShell语言的解析器,使用此处描述的语法:http://www.microsoft.com/en-us/download/details.aspx?id=9706。
我使用了Irony,而Irony Grammar Explorer报告了一些转移/减少和减少/减少错误。这个让我很难过,因为我不确定它告诉我的是什么。
State S79 (Inadequate) Shift-reduce conflicts on inputs: [ , + dash ++ dashdash Shift items: cast_expression -> type_literal ·unary_expression unary_expression -> ·primary_expression primary_expression -> ·value value -> ·parenthesized_expression parenthesized_expression -> ·( pipeline ) value -> ·sub_expression sub_expression -> ·$( statement_list_opt ) value -> ·array_expression array_expression -> ·@( statement_list_opt ) value -> ·script_block_expression script_block_expression -> ·{ script_block } value -> ·hash_literal_expression hash_literal_expression -> ·@{ hash_literal_body_opt } value -> ·literal literal -> ·integer_literal integer_literal -> ·decimal_integer_literal integer_literal -> ·hexadecimal_integer_literal literal -> ·real_literal literal -> ·string_literal string_literal -> ·expandable_string_literal string_literal -> ·verbatim_string_literal value -> ·type_literal type_literal -> ·[ type_spec ] value -> ·variable primary_expression -> ·member_access member_access -> ·primary_expression Unnamed6 member_name primary_expression -> ·element_access element_access -> ·primary_expression [ expression ] primary_expression -> ·post_increment_expression post_increment_expression -> ·primary_expression ++ primary_expression -> ·post_decrement_expression post_decrement_expression -> ·primary_expression dashdash unary_expression -> ·expression_with_unary_operator expression_with_unary_operator -> ·, unary_expression expression_with_unary_operator -> ·-not unary_expression expression_with_unary_operator -> ·! unary_expression 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 unary_expression expression_with_unary_operator -> ·-split unary_expression expression_with_unary_operator -> ·-join unary_expression Reduce items: value -> 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 isnot 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 } ) = ]] Transitions: 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, dash->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
这是加法还是演员?