Shunting yard algorithm

Stack-based algorithm for parsing infix mathematical expression

In computer science, the shunting yard algorithm is a method for parsing arithmetical or logical expressions, or a combination of both, specified in infix notation. It can produce either a postfix notation string, also known as reverse Polish notation (RPN), or an abstract syntax tree (AST).

Nº Q1199602 ★★

Incomum · Saberes

Shunting yard algorithm

Stack-based algorithm for parsing infix mathematical expression

Texto em inglês

In computer science, the shunting yard algorithm is a method for parsing arithmetical or logical expressions, or a combination of both, specified in infix notation. It can produce either a postfix notation string, also known as reverse Polish notation (RPN), or an abstract syntax tree (AST).

Último preço

—

Preço mínimo

—

Mediana 7 d

—

Vendas 30 d

0

Faixa 30 d

—

Em circulação

0

Cotação

Ver tabela
Datamediana MínMáxvendas

Histórico de vendas

Última venda
—
Média 30 d
—
Mínima 30 d
—
Máxima 30 d
—
Vendas 7 d
0
Vendas 30 d
0

Ainda sem vendas.

Vendas anônimas: sem comprador nem vendedor. Os números contam só vendas entre jogadores.

Na Wikipédia

Texto em inglês Ainda não há artigo no seu idioma: trecho em inglês.

In computer science, the shunting yard algorithm is a method for parsing arithmetical or logical expressions, or a combination of both, specified in infix notation. It can produce either a postfix notation string, also known as reverse Polish notation (RPN), or an abstract syntax tree (AST). The algorithm was invented by Edsger Dijkstra, first published in November 1961, and named because its operation resembles that of a railroad shunting yard. Like the evaluation of RPN, the shunting yard algorithm is stack-based. Infix expressions are the form of mathematical notation most people are used to, for instance "3 + 4" or "3 + 4 × (2 − 1)". For the conversion there are two text variables (strings), the input and the output. There is also a stack that holds operators not yet added to the output queue. To convert, the program reads each symbol in order and does something based on that symbol. The result for the above examples would be (in reverse Polish notation) "3 4 +" and "3 4 2 1 − × +", respectively. The shunting yard algorithm will correctly parse all valid infix expressions, but does not reject all invalid expressions. For example, "1 2 +" is not a valid infix expression, but would be parsed as "1 + 2". The algorithm can however reject expressions with mismatched parentheses. The shunting yard algorithm was later generalized into operator-precedence parsing.

Texto: Wikipédia em inglês, CC BY-SA 4.0. · Imagem: Salix alba (CC BY-SA 3.0) ·

Cartas próximas

Ver a ficha

Confirmação