summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GF/Speech/TransformCFG.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/GF/Speech/TransformCFG.hs b/src/GF/Speech/TransformCFG.hs
index 6a66bc5f0..33ef9771d 100644
--- a/src/GF/Speech/TransformCFG.hs
+++ b/src/GF/Speech/TransformCFG.hs
@@ -49,7 +49,7 @@ data CFTerm
= CFObj Fun [CFTerm] -- ^ an abstract syntax function with arguments
| CFAbs Int CFTerm -- ^ A lambda abstraction. The Int is the variable id.
| CFApp CFTerm CFTerm -- ^ Application
- | CFRes Int -- ^ The result of the n:th non-terminal
+ | CFRes Int -- ^ The result of the n:th (0-based) non-terminal
| CFVar Int -- ^ A lambda-bound variable
| CFMeta String -- ^ A metavariable
deriving (Eq,Ord,Show)
@@ -175,7 +175,9 @@ removeLeftRecursion start gr
shiftTerm :: CFTerm -> CFTerm
shiftTerm (CFObj f ts) = CFObj f (map shiftTerm ts)
shiftTerm (CFRes 0) = CFVar 1
+ shiftTerm (CFRes n) = CFRes (n-1)
shiftTerm t = t
+ -- note: the rest don't occur in the original grammar
cats = allCats gr
rules = ungroupProds gr