recursive-descent

Recursive descent: infix to postfix conversion repeating operators

ε祈祈猫儿з 提交于 2020-06-13 11:45:49
问题 We recently learned about converting infix to postfix using stacks during our programming course at uni. And I have meaning to write my parser for a while, so I decided to it using recursive descent. I am following along with this: Parsing Expressions by Recursive Descent Theodore Norvell . Here is the grammar he uses: E --> P {B P} P --> v | "(" E ")" | U P B --> "+" | "-" | "*" | "/" | "^" U --> "-" | "+" I have attempted at implementing this in C and it works. However If I give it the

Recursively dir() a python object to find values of a certain type or with a certain value

谁说胖子不能爱 提交于 2020-02-27 05:27:12
问题 I have a complex Python data structure (if it matters, it's a large music21 Score object) which will not pickle due to the presence of a weakref somewhere deep inside the object structure. I've debugged such problems with the stack trace and python debugger before, but it's always a big pain. Is there a tool which runs dir() recursively on all attributes of an object, finding objects hidden in lists, tuples, dicts, etc., and returns those that match a certain value (a lambda function or

Can somebody walk me through what this question is trying to ask of me?

◇◆丶佛笑我妖孽 提交于 2020-02-25 16:58:00
问题 The following programming languages question seems really unclear and what it wants me to do is not obvious to me, could somebody help me to understand it? The question: Implement part of a recursive descent parser for a simple set of language rules. Use any programming language for the implementation; if it isn’t a common language, please make a note of which language it is in a comment. You should implement functions for each of the nonterminal symbols and, using the following rules that

Can somebody walk me through what this question is trying to ask of me?

自闭症网瘾萝莉.ら 提交于 2020-02-25 16:57:11
问题 The following programming languages question seems really unclear and what it wants me to do is not obvious to me, could somebody help me to understand it? The question: Implement part of a recursive descent parser for a simple set of language rules. Use any programming language for the implementation; if it isn’t a common language, please make a note of which language it is in a comment. You should implement functions for each of the nonterminal symbols and, using the following rules that

Can somebody walk me through what this question is trying to ask of me?

谁说胖子不能爱 提交于 2020-02-25 16:56:33
问题 The following programming languages question seems really unclear and what it wants me to do is not obvious to me, could somebody help me to understand it? The question: Implement part of a recursive descent parser for a simple set of language rules. Use any programming language for the implementation; if it isn’t a common language, please make a note of which language it is in a comment. You should implement functions for each of the nonterminal symbols and, using the following rules that

Can somebody walk me through what this question is trying to ask of me?

好久不见. 提交于 2020-02-25 16:53:07
问题 The following programming languages question seems really unclear and what it wants me to do is not obvious to me, could somebody help me to understand it? The question: Implement part of a recursive descent parser for a simple set of language rules. Use any programming language for the implementation; if it isn’t a common language, please make a note of which language it is in a comment. You should implement functions for each of the nonterminal symbols and, using the following rules that

Recursive descent parsing: high precedence unary operators

◇◆丶佛笑我妖孽 提交于 2020-01-30 07:25:10
问题 I've figured out how to implement binary operators with precedence, like this (pseudocode): method plus times() while(consume(plus_t)) do times() end end method times number() while(consume(times_t)) number() end end // plus() is the root operation // omitted: number() consumes a number token So when I parse 4 + 5 * 6 it would: plus multiply number (4 consumed) plus_t consumed multiply number (5 consumed) times_t consumed number (6 consumed) However, when I try adding a minus method (prefix

Difference between an LL and Recursive Descent parser?

隐身守侯 提交于 2019-12-29 10:07:12
问题 I've recently being trying to teach myself how parsers (for languages/context-free grammars) work, and most of it seems to be making sense, except for one thing. I'm focusing my attention in particular on LL(k) grammars , for which the two main algorithms seem to be the LL parser (using stack/parse table) and the Recursive Descent parser (simply using recursion). As far as I can see, the recursive descent algorithm works on all LL(k) grammars and possibly more, whereas an LL parser works on

AWK: Recursive Descent CSV Parser

雨燕双飞 提交于 2019-12-24 15:27:47
问题 In response to a Recursive Descent CSV parser in BASH , I (the original author of both posts) have made the following attempt to translate it into AWK script, for speed comparison of data processing with these scripting languages. The translation is not a 1:1 translation due to several mitigating factors, but to those who are interested, this implementation is faster at string processing than the other. Originally we had a few questions that have all been quashed thanks to Jonathan Leffler.

Top-down parser classification

跟風遠走 提交于 2019-12-24 12:00:30
问题 I've watched this course by Alex Aiken and read through many other resources. But I'm struggling to find clear classification of top-down parsers. This document doesn't provide a clear classification either but at least gives some definitions I'll use in the post. So here is the classification I've come up so far: Backtracking VS Predictive Backtracking One solution to parsing would be to implement backtracking. Based on the information the parser currently has about the input, a decision is