I am trying to understand what is the relationship between L-attributed grammars and computing attributes during bottom-up parsing. Is it always possible to compute all attributes during syntax tree creation for every context-free grammar or just for some selected grammars like LR(k)? Let's assume that some transformations like adding new nonterminals and epsilon productions are allowed. I have been seeking some information about that but I cannot find.
Related Questions in PARSING
- TypeScript: Type checking while parsing an arbitrary JSON that is typed/
- How to have fixed options using Option.Applicative in haskell?
- How to convert mathematical expression to lambda function in C++?
- JsonObject throws an exception: JSONObject["employer_website"] is not a string (class org.json.JSONObject$Null : null)
- Trying to fix my c++ code for it to read the right amount of nodes from a file
- Selenium get page after "loading" page
- Parse tag in html via Google Sheets (importxml)
- FluentD / Fluent-Bit: Concatenate multiple lines of log files and generate one JSON record for all key-value from each line
- Editing non-String values in JComboBox
- Handling multiple errors in Bison parser
- Which is the most idiomatic way to parse an i32 from ascii in Rust
- I got this error from a JSON Validator - what does this mean?
- Conflict between lexer rules in ANTLR4 for Fortran grammar
- mqtt message parsing problem in a node.js
- How to print error code from URL response in swift
Related Questions in CONTEXT-FREE-GRAMMAR
- Resolve shift/reduction conflict in grammar for expressions in PLY for calls to embedded functions
- Grammar for access to properties and calls to embedded functions
- Need clarification on pumping lemma for context free languages
- Java CUP produces Shift-Reduce conflict when parsing a grammar for a C++ type language
- Correct labeling for this regular language?
- How to recognize a context free grammar with a rust declarative macro
- Maximum recursion depth exceeded with nltk recursive descent parser
- Constructing grammar based on given rules
- how to find the grammar of this Language?
- ANTLR4 - parse function-like structures in regular text
- Context Free Grammar for L= { a^n b^m c^m d^2n }, where n and m are >= 0
- Is this grammar LALR(1)?
- How can I generate a Context Free Grammar for a specific language
- How to auto-complete JSON syntax strings?
- I have a problem in reducing a grammar to LL(1)
Related Questions in BOTTOM-UP
- Eliminating Recursion stack space
- bottom up register allocation, reserving register for loads/stores
- Cant initialize a 2d array/matrix to 0
- Recursive query sum leaf values and pass sum to parents. Values stored in another table
- How do you implement the bottom-up and top-down approach in this problem?
- How can I add limited coins to the coin change problem? (Bottom-up - Dynamic programming)
- Count the sum of subsets of size k when the sum is (Greater than or equal to R) or (Lesser than or equal to L)
- Runtime Error when Trying Bottom Up Approach to Implement Fibonacci function in Swift?
- when adding new text it appears on bottom and rest of text goes up
- How to convert the recursive solution to "Moons and Umbrellas" to DP?
- LR-Parsing-Table: What determines next state in reduce-actions?
- Output produced for the given input using the bottom up parsing
- L-attributed grammar and bottom-up parsing
- Parsing table size (bottom-up)
- Find k out of n subset with maximal area
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
If you can construct the parse tree bottom-up left-to-right, then you can compute L-attributes. That's a tautology because L-attributes are those attributes which you can compute bottom-up left-to-right. How you manage to do the parse is irrelevant.
Generalised LR parsing algorithms allow you to parse bottom-up left-to-right, with the proviso that there may be more than one possible parse available at a given moment. (In fact, if the grammar is not required to be unambiguous, more than one parse of the entire input could be possible.)
In practice, computing attributes for parse nodes before you know that they are part of the final parse can be extremely inefficient. Also in practice, one would insert here a warning about actions with side effects, but computing an attribute of a parse node is not a side-effect in itself, and if it has some other effect on the universe then we are no longer in the territory of the mathematical theory.
Furthermore, if the grammar is unambiguous, the number of possible parses could be exponential in the length of the input. Most generalised LR algorithms construct parse graphs rather than parse trees, which can be done using only polynomial space to represent the exponential number of possible trees. But that requires sharing nodes between different parses which might not be possible in the face of attribute computation, since the nodes to be shared might turn out to have different attributes.
Here, I think, it's worthwhile to revisit the question of side effects mentioned above, because it might not really be the case that computing the value of an attribute for a node is not a side effect. If you are building a persistent structure (a parse tree) which is observable during its construction, then assigning an attribute to a component of that structure is certainly a side effect. On the other hand, if the structure is not externally visible during its construction, then it doesn't matter when you assign attributes to components. In that case, it might be better to think of L-attributes as those attributes which can be computed in a single depth-first left-to-right traverse of the (fully constructed) parse tree.