GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.rs — rustpython_parser - Rust Expand descriptionThis crate can be used to parse Python source code into an Abstract Syntax Tree. §Overview:The process by which source code is parsed into an AST can be broken down into two general stages: lexical analysis and parsing. During lexical analysis, the source code is converted into a stream of lexical
tokens that represent the smallest meaningful units of the language. For example,
the source code these tokens are then consumed by the parser, which matches them against a set of grammar rules to verify that the source code is syntactically valid and to construct an AST that represents the source code. During parsing, the parser consumes the tokens generated by the lexer and constructs a tree representation of the source code. The tree is made up of nodes that represent the different syntactic constructs of the language. If the source code is syntactically invalid, parsing fails and an error is returned. After a successful parse, the AST can be used to perform further analysis on the source code. Continuing with the example above, the AST generated by the parser would roughly look something like this: Note: The Tokens/ASTs shown above are not the exact tokens/ASTs generated by the parser. §Source code layout:The functionality of this crate is split into several modules:
§ExamplesFor example, to get a stream of tokens from a given string, one could do this: These tokens can be directly fed into the parser to generate an AST: Alternatively, you can use one of the other Re-exports§
Modules§
Enums§
Traits§
Functions§
Type Aliases§
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |