Talk:Recursive descent parser generator: Difference between revisions

no edit summary
mNo edit summary
No edit summary
Line 1:
== Input specification ==
The main thing that needs to be fixed before adding any examples is the input specification. I want to make it detailed enough to be at least slightly usable (so more than just a recognizer) but I'm having trouble coming up with a clear way of expressing both the rule and the extra code generated when the rule is applied, especially taking in to account all the different languages that you might want to output with or to. Here's one attempt, but as you can see, it's not that clear:
 
<pre>
header code to output
!! start
pre-traversal code here
-> var expr
post-traversal code here
 
!! start -> var expr
more code
 
!! expr -> var'+' expr
...
</pre>
 
Is there any way to simplify this? (I doncan't seem to remember, anycan parseryou generatorsdo using two pieces of code likeeverything that, butneeds Ito can'tbe finddone anythingwith sayinga youheader can get away withand just one rightpost-traversal now.output?)
 
The example I want to use is to take an arithmetic expression and turn it in to a series of single operations in the right order. So:
Line 25:
_d = _b + _c
</pre>
 
Oh yeah, if the task specification says to output the parser in your language of choice, the example will have to be rewritten for each language too, unless there's some way around that.
 
[[User:MagiMaster|MagiMaster]] ([[User talk:MagiMaster|talk]]) 06:10, 2 April 2014 (UTC)