Global Information Lookup Global Information

Shunting yard algorithm information


Shunting yard algorithm
ClassParsing
Data structureStack
Worst-case performance
Worst-case space complexity

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).[1] The algorithm was invented by Edsger Dijkstra and named the "shunting yard" algorithm because its operation resembles that of a railroad shunting yard. Dijkstra first described the shunting yard algorithm in the Mathematisch Centrum report MR 34/61.

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.

  1. ^ Theodore Norvell (1999). "Parsing Expressions by Recursive Descent". www.engr.mun.ca. Retrieved 2020-12-28.

and 14 Related for: Shunting yard algorithm information

Request time (Page generated in 0.82 seconds.)

Shunting yard algorithm

Last Update:

The algorithm was invented by Edsger Dijkstra and named the "shunting yard" algorithm because its operation resembles that of a railroad shunting yard. Dijkstra...

Word Count : 1036

Shunting yard

Last Update:

Shunting yard may refer to: Classification yard Shunting yard algorithm British term for rail yard This disambiguation page lists articles associated with...

Word Count : 47

Abstract syntax tree

Last Update:

also known as concrete syntax tree Semantic resolution tree (SRT) Shunting-yard algorithm Symbol table TreeDL Abstract Syntax Tree Interpreters Fluri, Beat;...

Word Count : 1214

List of Dutch inventions and innovations

Last Update:

The algorithm was invented by Edsger Dijkstra and named the "shunting yard" algorithm because its operation resembles that of a railroad shunting yard. Dijkstra...

Word Count : 23385

List of algorithms

Last Update:

grammars Shunting-yard algorithm: converts an infix-notation math expression to postfix Pratt parser Lexical analysis Deutsch–Jozsa algorithm: criterion...

Word Count : 7843

Infix notation

Last Update:

Reverse Polish notation Prefix notation, also called Polish notation Shunting yard algorithm, used to convert infix notation to postfix notation or to a tree...

Word Count : 348

Exp4j

Last Update:

evaluation of mathematical expressions. It implements Dijkstra's Shunting-yard algorithm to translate expressions from infix notation to Reverse Polish...

Word Count : 146

Parsing

Last Update:

descent parser: a top-down parser suitable for LL(k) grammars Shunting-yard algorithm: converts an infix-notation math expression to postfix Pratt parser...

Word Count : 4857

Reverse Polish notation

Last Update:

previously learned algebraic notation. Edsger W. Dijkstra invented the shunting-yard algorithm to convert infix expressions to postfix expressions (reverse Polish...

Word Count : 6764

Comparison of parser generators

Last Update:

Mixed internal All Yes Free, BSD KDevelop-PG-Qt LL(1), backtracking, shunting-yard ? C++ Mixed generated or external All, KDE No Free, GNU LGPL Kelbt Backtracking...

Word Count : 1106

Artificial intelligence for video surveillance

Last Update:

program functions by using machine vision. Machine vision is a series of algorithms, or mathematical procedures, which work like a flow-chart or series of...

Word Count : 3598

History of decompression research and development

Last Update:

nitrogen and oxygen known generically as Trimix. Bühlmann algorithm VPM algorithm RGBM algorithm To a large extent commercial offshore diving uses heliox...

Word Count : 12629

London Underground

Last Update:

optimized using a global network optimization approach, akin to routing algorithms for Internet applications. Analysis of the Underground as a network may...

Word Count : 19085

List of University of Washington people

Last Update:

Baker – biochemist and computational biologist; developed the Rosetta algorithm for protein structure prediction; recipient of the 2021 Breakthrough Prize...

Word Count : 8934

PDF Search Engine © AllGlobal.net