Questions tagged [recursive-descent]

Recursive Descent Parser is a kind of top-down parser built as a set of recursive procedures each implementing a production rule of the grammar.

Recursive descent parsers can be hand-written or generated. Examples of parser generators producing recursive descent parsers include ANTLR, Coco/R, and JavaCC.

207 questions
1
vote
1 answer

Parsing a simple extension of latex: grammar, recursive descent, pyParsing?

I would like to do a small extension of latex syntax. There are pure latex ways to avoid this parsing exercise, and I know them. The goal of this question is to solve the following parsing problem. If \ep is small --> If…
user1030312
1
vote
2 answers

Tsql looping father-son relationship between tables

I have a table like this: table item ( id int, quantity float, father int, -- refer to item itself in case of subitem ) I need to sum al quantity plus sons quantity like this way: select i.id, max(i.quantity)+sum(ft.quantity) as…
Tobia
  • 9,165
  • 28
  • 114
  • 219
1
vote
1 answer

bash recursive CSV parser

I have moved this question to code review I've written a recursive descent parser in bash. I'm wondering if you can point out something helpful to me. It supports backslash escapes and quoted fields with parse error reporting. The script works like…
user735796
0
votes
2 answers

Unambiguous Grammar

I want to create an unambiguous grammar for arithmetic expressions. Now the exponentiation should be of higher precedence and associate to the right. All other operations associate to the left. This is what I have so far but I don't know if the…
user1072706
  • 573
  • 2
  • 8
  • 20
0
votes
1 answer

Need help writing Java method to perform recursive descent parse

Official problem: Write Java method to perform recursive descent parse of the following production: -> REPEAT UNTIL ; This is what I've come up with: void repeatStatement() { if(token == REPEAT) { …
tommy1370
  • 133
  • 1
  • 2
  • 10
0
votes
0 answers

Why is my Recursive Descent Parser not parsing an empty string?

coding gods really wondering if someone can help with this little ol issue, this is what I've currently got it is a Recursive Descent Parser that takes Jack code and translates it into a parse-tree, I'm currently having an issue with parsing an…
Chappi
  • 1
0
votes
0 answers

What are the criteria for determining if a language can be parsed using recursive descent parsing?

How do i know if a language can be parsed by recursive descent parsing? For example, how would i go about determining whether this language can be parsed in that manner: Language = { s^p r^q | p > q }? I have tried reading about the concept but it…
yes12345
  • 11
  • 2
0
votes
1 answer

languages parsed with recursive descent

I was wondering what makes languages possible to be parsed with recursive descent. for example we have 5 languages over {x,y,r}: A = { x^n y^n | n <= k } B = { x^n y^k | n > k } C = { x^k y^n | k > n } D = { x^n y^n r^n | n <= k } E = { x^n y^n r^n…
phuck
  • 23
  • 6
0
votes
1 answer

Recursive descent parser from BNF grammar in java

I need to make a recursive descent parser that follows the grammar |
Dagun
  • 41
  • 5
0
votes
1 answer

Removing left recursion from JSF*ck grammar rules

I am trying to figure out a JSF*uck grammar. I read the actual JavaScript grammar here and only took the grammar rules that were relevant to JSF*ck and got this: Expression: AdditiveExpression ; AdditiveExpression: UnaryExpression |…
Lorenzo
  • 591
  • 7
  • 18
0
votes
0 answers

Verifying if an expression conforms to restrictive context-free grammar

I'm trying to write a parser that accepts a toy language for a software project class. Part of the production rules relevant to the question in EBNF-like syntax is given here (there's way more relational operators, but I've removed some of them to…
0
votes
0 answers

How to make recursive descent parsing recognise expressions

I am making a graphing calculator and the issue I am having is finding a way to take in inputs like sin(90) and run my function for sin that I coded into another file. I am using a recursive descent parser to go through each input and assign it to a…
Irodi
  • 1
  • 1
0
votes
0 answers

Types of Top down parsers

I want to clearly classify top down parsers. After reading lot of resources, i am connecting the dots. I concluded following - There are 2 types of top down parsers - One that uses backtracking Another that doesn't use backtracking (also called…
0
votes
1 answer

The token was already consumed by another rule, Can't parse the token again

I am constructing an LL(1) parser (Recursive Descent Parser) and I need to parse the sentence a = 3, I have two procedures to match that rule: parse_assignment and parse_binary_operator, each function consumes the first token, and then it needs to…
Jonathan1609
  • 1,809
  • 1
  • 5
  • 22
0
votes
2 answers

Recursive-descent parser

The question is to write a recursive-descent parser for a language that contains sentences of form w+w', in which w is an arbitrary string of lowercase chars, w' is the reverse of w, and + the plus character. Examples of this language…