summaryrefslogtreecommitdiff
path: root/src/runtime/haskell/PGF/Optimize.hs
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-09-27 15:09:48 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-09-27 15:09:48 +0000
commit426bc49a52b4efa0ef0129d713842d8c9abdf0ff (patch)
treed9f5985559de0347448e77ff26ce5a2d3ee2f245 /src/runtime/haskell/PGF/Optimize.hs
parentb138899512d9aea248160eb17df3007e55dd03da (diff)
a major refactoring in the C and the Haskell runtimes. Note incompatible change in the PGF format!!!
The following are the outcomes: - Predef.nonExist is fully supported by both the Haskell and the C runtimes - Predef.BIND is now an internal compiler defined token. For now it behaves just as usual for the Haskell runtime, i.e. it generates &+. However, the special treatment will let us to handle it properly in the C runtime. - This required a major change in the PGF format since both nonExist and BIND may appear inside 'pre' and this was not supported before.
Diffstat (limited to 'src/runtime/haskell/PGF/Optimize.hs')
-rw-r--r--src/runtime/haskell/PGF/Optimize.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/runtime/haskell/PGF/Optimize.hs b/src/runtime/haskell/PGF/Optimize.hs
index a339c9add..f04a8b04c 100644
--- a/src/runtime/haskell/PGF/Optimize.hs
+++ b/src/runtime/haskell/PGF/Optimize.hs
@@ -221,9 +221,13 @@ splitLexicalRules cnc p_prods =
wf ts = (ts,IntSet.singleton funid)
- seq2prefix [] = TrieMap.fromList [wf []]
- seq2prefix (SymKS ts :syms) = TrieMap.fromList [wf ts]
- seq2prefix (SymKP ts alts:syms) = TrieMap.fromList (wf ts : [wf ts | Alt ts ps <- alts])
+ seq2prefix [] = TrieMap.fromList [wf []]
+ seq2prefix (SymKS t :syms) = TrieMap.fromList [wf [t]]
+ seq2prefix (SymKP syms0 alts:syms) = TrieMap.unionsWith IntSet.union
+ (seq2prefix (syms0++syms) :
+ [seq2prefix (syms1 ++ syms) | (syms1,ps) <- alts])
+ seq2prefix (SymNE :syms) = TrieMap.empty
+ seq2prefix (SymBIND :syms) = TrieMap.fromList [wf ["&+"]]
updateConcrete abs cnc =
let p_prods0 = filterProductions IntMap.empty IntSet.empty (productions cnc)