mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
Use LCLR algorithm for eliminating left-recursion, with lambda terms in SISR for getting trees right.
This commit is contained in:
@@ -44,5 +44,6 @@ data Expr =
|
||||
| ENull
|
||||
| EThis
|
||||
| EFun [Ident] [Stmt]
|
||||
| ESeq [Expr]
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
|
||||
@@ -39,6 +39,10 @@ ENull. Expr16 ::= "null" ;
|
||||
EThis. Expr16 ::= "this" ;
|
||||
EFun. Expr16 ::= "function" "(" [Ident] ")" "{" [Stmt] "}" ;
|
||||
|
||||
eseq1. Expr16 ::= "(" Expr "," [Expr] ")";
|
||||
internal ESeq. Expr16 ::= "(" [Expr] ")" ;
|
||||
define eseq1 x xs = ESeq (x:xs);
|
||||
|
||||
separator Expr "," ;
|
||||
coercions Expr 16 ;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{-# OPTIONS -fglasgow-exts -cpp #-}
|
||||
{-# LINE 3 "GF/JavaScript/LexJS.x" #-}
|
||||
{-# LINE 3 "LexJS.x" #-}
|
||||
{-# OPTIONS -fno-warn-incomplete-patterns #-}
|
||||
module GF.JavaScript.LexJS where
|
||||
|
||||
@@ -27,16 +27,16 @@ alex_base :: AlexAddr
|
||||
alex_base = AlexA# "\xf8\xff\xff\xff\xfd\xff\xff\xff\x02\x00\x00\x00\x00\x00\x00\x00\xc8\x00\x00\x00\x00\x00\x00\x00\x73\x00\x00\x00\x01\x01\x00\x00\x4e\x00\x00\x00\x13\x01\x00\x00\x58\x00\x00\x00\x66\x00\x00\x00\x70\x00\x00\x00\x7d\x00\x00\x00"#
|
||||
|
||||
alex_table :: AlexAddr
|
||||
alex_table = AlexA# "\x00\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x03\x00\x03\x00\x02\x00\x00\x00\x03\x00\x00\x00\x03\x00\x00\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x03\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x03\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b\x00\xff\xff\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x05\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0c\x00\x00\x00\x00\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x07\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x06\x00\x00\x00\x00\x00\x00\x00\x04\x00\x06\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
|
||||
alex_table = AlexA# "\x00\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x03\x00\x03\x00\x02\x00\x00\x00\x03\x00\x00\x00\x03\x00\x00\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x00\x00\x03\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x03\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x03\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b\x00\xff\xff\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x08\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x05\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0c\x00\x00\x00\x00\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x07\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x06\x00\x00\x00\x00\x00\x00\x00\x04\x00\x06\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x00\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
|
||||
|
||||
alex_check :: AlexAddr
|
||||
alex_check = AlexA# "\xff\xff\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x22\x00\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\x28\x00\x29\x00\x20\x00\xff\xff\x2c\x00\xff\xff\x2e\x00\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\x3b\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\xff\xff\x5d\x00\xff\xff\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\xff\xff\x7d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2e\x00\x0a\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x22\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\x5c\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\x27\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x22\x00\xff\xff\xff\xff\xff\xff\x5f\x00\x27\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x6e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x74\x00\xff\xff\xff\xff\x65\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xff\xff\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xff\xff\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#
|
||||
alex_check = AlexA# "\xff\xff\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x20\x00\xff\xff\x22\x00\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\x28\x00\x29\x00\x20\x00\xff\xff\x2c\x00\xff\xff\x2e\x00\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\x3b\x00\xff\xff\x3d\x00\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\xff\xff\x5d\x00\xff\xff\xff\xff\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\xff\xff\x7d\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x2e\x00\x0a\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\x22\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x2d\x00\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\x5c\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\x27\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x22\x00\xff\xff\xff\xff\xff\xff\x5f\x00\x27\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x6e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x74\x00\xff\xff\xff\xff\x65\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xff\xff\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xff\xff\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#
|
||||
|
||||
alex_deflt :: AlexAddr
|
||||
alex_deflt = AlexA# "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x06\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#
|
||||
|
||||
alex_accept = listArray (0::Int,13) [[],[],[(AlexAccSkip)],[(AlexAcc (alex_action_1))],[(AlexAcc (alex_action_2))],[(AlexAcc (alex_action_3))],[],[],[(AlexAcc (alex_action_4))],[(AlexAcc (alex_action_5))],[(AlexAcc (alex_action_5))],[],[],[]]
|
||||
{-# LINE 32 "GF/JavaScript/LexJS.x" #-}
|
||||
{-# LINE 32 "LexJS.x" #-}
|
||||
|
||||
tok f p s = f p s
|
||||
|
||||
@@ -84,7 +84,7 @@ eitherResIdent tv s = treeFind resWords
|
||||
| s > a = treeFind right
|
||||
| s == a = t
|
||||
|
||||
resWords = b "null" (b "function" (b "false" N N) (b "new" N N)) (b "this" (b "return" N N) (b "true" N N))
|
||||
resWords = b "return" (b "new" (b "function" (b "false" N N) N) (b "null" N N)) (b "true" (b "this" N N) (b "var" N N))
|
||||
where b s = B s (TS s)
|
||||
|
||||
unescapeInitTail :: String -> String
|
||||
|
||||
14
src/GF/JavaScript/Makefile
Normal file
14
src/GF/JavaScript/Makefile
Normal file
@@ -0,0 +1,14 @@
|
||||
all:
|
||||
happy -gca ParJS.y
|
||||
alex -g LexJS.x
|
||||
|
||||
bnfc:
|
||||
(cd ../.. && bnfc -p GF.JavaScript GF/JavaScript/JS.cf)
|
||||
-rm -f *.bak
|
||||
|
||||
clean:
|
||||
-rm -f *.log *.aux *.hi *.o *.dvi
|
||||
-rm -f DocJS.ps
|
||||
distclean: clean
|
||||
-rm -f DocJS.* LexJS.* ParJS.* LayoutJS.* SkelJS.* PrintJS.* TestJS.* AbsJS.* TestJS ErrM.* SharedString.* JS.dtd XMLJS.* Makefile*
|
||||
|
||||
@@ -78,28 +78,28 @@ happyIn13 x = unsafeCoerce# x
|
||||
happyOut13 :: (HappyAbsSyn ) -> ([Stmt])
|
||||
happyOut13 x = unsafeCoerce# x
|
||||
{-# INLINE happyOut13 #-}
|
||||
happyIn14 :: (Expr) -> (HappyAbsSyn )
|
||||
happyIn14 :: (DeclOrExpr) -> (HappyAbsSyn )
|
||||
happyIn14 x = unsafeCoerce# x
|
||||
{-# INLINE happyIn14 #-}
|
||||
happyOut14 :: (HappyAbsSyn ) -> (Expr)
|
||||
happyOut14 :: (HappyAbsSyn ) -> (DeclOrExpr)
|
||||
happyOut14 x = unsafeCoerce# x
|
||||
{-# INLINE happyOut14 #-}
|
||||
happyIn15 :: (Expr) -> (HappyAbsSyn )
|
||||
happyIn15 :: (DeclVar) -> (HappyAbsSyn )
|
||||
happyIn15 x = unsafeCoerce# x
|
||||
{-# INLINE happyIn15 #-}
|
||||
happyOut15 :: (HappyAbsSyn ) -> (Expr)
|
||||
happyOut15 :: (HappyAbsSyn ) -> (DeclVar)
|
||||
happyOut15 x = unsafeCoerce# x
|
||||
{-# INLINE happyOut15 #-}
|
||||
happyIn16 :: (Expr) -> (HappyAbsSyn )
|
||||
happyIn16 :: ([DeclVar]) -> (HappyAbsSyn )
|
||||
happyIn16 x = unsafeCoerce# x
|
||||
{-# INLINE happyIn16 #-}
|
||||
happyOut16 :: (HappyAbsSyn ) -> (Expr)
|
||||
happyOut16 :: (HappyAbsSyn ) -> ([DeclVar])
|
||||
happyOut16 x = unsafeCoerce# x
|
||||
{-# INLINE happyOut16 #-}
|
||||
happyIn17 :: ([Expr]) -> (HappyAbsSyn )
|
||||
happyIn17 :: (Expr) -> (HappyAbsSyn )
|
||||
happyIn17 x = unsafeCoerce# x
|
||||
{-# INLINE happyIn17 #-}
|
||||
happyOut17 :: (HappyAbsSyn ) -> ([Expr])
|
||||
happyOut17 :: (HappyAbsSyn ) -> (Expr)
|
||||
happyOut17 x = unsafeCoerce# x
|
||||
{-# INLINE happyOut17 #-}
|
||||
happyIn18 :: (Expr) -> (HappyAbsSyn )
|
||||
@@ -120,10 +120,10 @@ happyIn20 x = unsafeCoerce# x
|
||||
happyOut20 :: (HappyAbsSyn ) -> (Expr)
|
||||
happyOut20 x = unsafeCoerce# x
|
||||
{-# INLINE happyOut20 #-}
|
||||
happyIn21 :: (Expr) -> (HappyAbsSyn )
|
||||
happyIn21 :: ([Expr]) -> (HappyAbsSyn )
|
||||
happyIn21 x = unsafeCoerce# x
|
||||
{-# INLINE happyIn21 #-}
|
||||
happyOut21 :: (HappyAbsSyn ) -> (Expr)
|
||||
happyOut21 :: (HappyAbsSyn ) -> ([Expr])
|
||||
happyOut21 x = unsafeCoerce# x
|
||||
{-# INLINE happyOut21 #-}
|
||||
happyIn22 :: (Expr) -> (HappyAbsSyn )
|
||||
@@ -186,6 +186,24 @@ happyIn31 x = unsafeCoerce# x
|
||||
happyOut31 :: (HappyAbsSyn ) -> (Expr)
|
||||
happyOut31 x = unsafeCoerce# x
|
||||
{-# INLINE happyOut31 #-}
|
||||
happyIn32 :: (Expr) -> (HappyAbsSyn )
|
||||
happyIn32 x = unsafeCoerce# x
|
||||
{-# INLINE happyIn32 #-}
|
||||
happyOut32 :: (HappyAbsSyn ) -> (Expr)
|
||||
happyOut32 x = unsafeCoerce# x
|
||||
{-# INLINE happyOut32 #-}
|
||||
happyIn33 :: (Expr) -> (HappyAbsSyn )
|
||||
happyIn33 x = unsafeCoerce# x
|
||||
{-# INLINE happyIn33 #-}
|
||||
happyOut33 :: (HappyAbsSyn ) -> (Expr)
|
||||
happyOut33 x = unsafeCoerce# x
|
||||
{-# INLINE happyOut33 #-}
|
||||
happyIn34 :: (Expr) -> (HappyAbsSyn )
|
||||
happyIn34 x = unsafeCoerce# x
|
||||
{-# INLINE happyIn34 #-}
|
||||
happyOut34 :: (HappyAbsSyn ) -> (Expr)
|
||||
happyOut34 x = unsafeCoerce# x
|
||||
{-# INLINE happyOut34 #-}
|
||||
happyInTok :: Token -> (HappyAbsSyn )
|
||||
happyInTok x = unsafeCoerce# x
|
||||
{-# INLINE happyInTok #-}
|
||||
@@ -194,21 +212,21 @@ happyOutTok x = unsafeCoerce# x
|
||||
{-# INLINE happyOutTok #-}
|
||||
|
||||
happyActOffsets :: HappyAddr
|
||||
happyActOffsets = HappyA# "\x00\x00\x68\x00\x00\x00\x62\x00\xdc\x00\x00\x00\x00\x00\x00\x00\x65\x00\xa8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa9\x00\x00\x00\x6f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb5\x00\x00\x00\x00\x00\x4d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5c\x00\xda\x00\x00\x00\x00\x00\x4b\x00\x59\x00\x57\x00\x00\x00\xb5\x00\xc2\x00\xb5\x00\x36\x00\x00\x00\x3f\x00\x3d\x00\x00\x00\xb5\x00\x3b\x00\x3c\x00\x3a\x00\x15\x00\x23\x00\xb5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd8\x00\x00\x00\x00\x00"#
|
||||
happyActOffsets = HappyA# "\x00\x00\x76\x00\x00\x00\x70\x00\x78\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9d\x00\x00\x00\x9a\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9c\x01\x00\x00\x00\x00\x11\x00\x73\x00\x00\x00\x8e\x01\x00\x00\x00\x00\x73\x00\x00\x00\x00\x00\x00\x00\x99\x00\x82\x00\x00\x00\x7f\x00\x00\x00\x83\x00\x81\x00\x69\x00\x56\x00\x62\x01\x05\x00\x9c\x01\x56\x00\x9c\x01\x9c\x01\x00\x00\x00\x00\x59\x00\x00\x00\x66\x00\x7e\x00\x00\x00\x9c\x01\x00\x00\x00\x00\x7c\x00\x65\x00\x35\x00\x9c\x01\x00\x00\x35\x00\x9c\x01\x00\x00\x00\x00\x64\x00\x63\x00\x61\x00\x34\x00\x60\x00\x9c\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x46\x00\x00\x00\x00\x00\x4c\x01\x00\x00\x36\x01\x00\x00\x00\x00"#
|
||||
|
||||
happyGotoOffsets :: HappyAddr
|
||||
happyGotoOffsets = HappyA# "\x1e\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x1a\x00\x21\x00\x8d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x71\x00\x00\x00\x00\x00\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfe\xff\x00\x00\x00\x00\x77\x00\x00\x00\x00\x00\x00\x00\x39\x00\xd7\x00\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d\x00\x00\x00\x00\x00\x00\x00\x5b\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xfd\xff\x00\x00\x00\x00"#
|
||||
happyGotoOffsets = HappyA# "\x23\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18\x01\x3d\x00\x00\x00\x45\x00\x31\x00\x00\x00\xf9\x00\x00\x00\x00\x00\xbb\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\x20\x00\x00\x00\x9c\x00\x2b\x00\xda\x00\xb3\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x43\x00\x5e\x00\x00\x00\xae\x01\xbb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x25\x00\x00\x00\x3f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d\x00\x00\x00\x00\x00\xff\xff\x20\x00\x00\x00\x20\x00\x00\x00\x00\x00"#
|
||||
|
||||
happyDefActions :: HappyAddr
|
||||
happyDefActions = HappyA# "\xf7\xff\x00\x00\xfe\xff\x00\x00\xfa\xff\xf6\xff\xf8\xff\xef\xff\x00\x00\x00\x00\xe7\xff\xe6\xff\xe5\xff\xe4\xff\xce\xff\xec\xff\xe8\xff\x00\x00\xdb\xff\xda\xff\xd9\xff\xd8\xff\xd7\xff\xd6\xff\xd5\xff\xd4\xff\xd3\xff\xd2\xff\xd1\xff\xd0\xff\xcf\xff\x00\x00\xf1\xff\xe2\xff\x00\x00\xe1\xff\xe0\xff\xe3\xff\xfd\xff\xfc\xff\xfb\xff\x00\x00\x00\x00\xee\xff\xf2\xff\xf5\xff\x00\x00\x00\x00\xf0\xff\xde\xff\x00\x00\x00\x00\x00\x00\xeb\xff\x00\x00\xdd\xff\xdf\xff\xde\xff\xf4\xff\x00\x00\x00\x00\xf5\xff\x00\x00\xde\xff\xe9\xff\xea\xff\xdc\xff\xed\xff\xf3\xff\xef\xff\x00\x00\xf9\xff"#
|
||||
happyDefActions = HappyA# "\xf7\xff\x00\x00\xfe\xff\x00\x00\xfa\xff\xdd\xff\xdc\xff\xdb\xff\xda\xff\xf6\xff\xf8\xff\x00\x00\xc3\xff\xe4\xff\xe2\xff\xde\xff\xeb\xff\xcf\xff\xce\xff\xcd\xff\xcc\xff\xcb\xff\xca\xff\xc9\xff\xc8\xff\xc7\xff\xc6\xff\xc5\xff\xc4\xff\x00\x00\xee\xff\xd8\xff\x00\x00\x00\x00\xd7\xff\x00\x00\xd6\xff\xd9\xff\xe8\xff\xfd\xff\xfc\xff\xfb\xff\xea\xff\xe7\xff\xec\xff\x00\x00\xf1\xff\x00\x00\x00\x00\x00\x00\xf5\xff\x00\x00\x00\x00\xd2\xff\x00\x00\x00\x00\x00\x00\xef\xff\xe5\xff\x00\x00\xe1\xff\x00\x00\xd1\xff\xd3\xff\xd2\xff\xed\xff\xf2\xff\xf4\xff\x00\x00\xf5\xff\xd2\xff\xf0\xff\xe8\xff\x00\x00\xe9\xff\xe6\xff\x00\x00\x00\x00\x00\x00\xf5\xff\x00\x00\xd2\xff\xdf\xff\xe0\xff\xd0\xff\xd4\xff\xf3\xff\xee\xff\x00\x00\xe3\xff\xee\xff\x00\x00\xd5\xff\x00\x00\xf9\xff"#
|
||||
|
||||
happyCheck :: HappyAddr
|
||||
happyCheck = HappyA# "\xff\xff\x00\x00\x01\x00\x02\x00\x03\x00\x08\x00\x08\x00\x05\x00\x09\x00\x00\x00\x08\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x00\x00\x01\x00\x02\x00\x03\x00\x00\x00\x04\x00\x09\x00\x06\x00\x02\x00\x11\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x00\x00\x01\x00\x02\x00\x03\x00\x03\x00\x02\x00\x09\x00\x05\x00\x02\x00\x05\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x00\x00\x01\x00\x02\x00\x03\x00\x02\x00\x01\x00\x00\x00\x11\x00\x01\x00\x11\x00\x0a\x00\x0b\x00\x0c\x00\x07\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x00\x00\x01\x00\x02\x00\x03\x00\x06\x00\x11\x00\x00\x00\x16\x00\x11\x00\xff\xff\x0a\x00\x0b\x00\x0c\x00\x07\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x00\x00\x01\x00\x02\x00\x03\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0a\x00\x0b\x00\x0c\x00\xff\xff\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x01\x00\x01\x00\xff\xff\xff\xff\xff\xff\x06\x00\xff\xff\x07\x00\x08\x00\x0a\x00\xff\xff\x0c\x00\x0d\x00\x01\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\xff\xff\xff\xff\x0a\x00\xff\xff\x0c\x00\x0d\x00\x01\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\xff\xff\xff\xff\x0a\x00\xff\xff\xff\xff\x0d\x00\xff\xff\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x01\x00\x02\x00\x03\x00\x03\x00\x04\x00\x03\x00\x04\x00\x03\x00\xff\xff\xff\xff\xff\xff\x0c\x00\xff\xff\xff\xff\x0e\x00\x0b\x00\x0e\x00\xff\xff\x0e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#
|
||||
happyCheck = HappyA# "\xff\xff\x00\x00\x01\x00\x02\x00\x03\x00\x01\x00\x05\x00\x02\x00\x09\x00\x08\x00\x05\x00\x0a\x00\x08\x00\x09\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x01\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x00\x00\x01\x00\x02\x00\x03\x00\x13\x00\x00\x00\x09\x00\x04\x00\x08\x00\x06\x00\x0a\x00\x00\x00\x07\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x00\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x00\x00\x01\x00\x02\x00\x03\x00\x00\x00\x00\x00\x00\x00\x09\x00\x13\x00\x13\x00\x03\x00\x07\x00\x07\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x00\x00\x01\x00\x02\x00\x03\x00\x02\x00\x0a\x00\x03\x00\x02\x00\x02\x00\x02\x00\x02\x00\x13\x00\x01\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x00\x00\x01\x00\x02\x00\x03\x00\x05\x00\x01\x00\x05\x00\x01\x00\x06\x00\x13\x00\x05\x00\x18\x00\x13\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x00\x00\x01\x00\x02\x00\x03\x00\x07\x00\x07\x00\xff\xff\x06\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x00\x00\x01\x00\x02\x00\x03\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0d\x00\x0e\x00\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x00\x00\x01\x00\x02\x00\x03\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0d\x00\x0e\x00\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x00\x00\x01\x00\x02\x00\x03\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0d\x00\x0e\x00\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x00\x00\x01\x00\x02\x00\x03\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0d\x00\x0e\x00\x0f\x00\x10\x00\xff\xff\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x01\x00\xff\xff\x03\x00\x04\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x01\x00\xff\xff\x03\x00\x04\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x01\x00\xff\xff\x03\x00\x04\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x01\x00\xff\xff\x03\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x01\x00\xff\xff\xff\xff\xff\xff\xff\xff\x06\x00\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x01\x00\x10\x00\x11\x00\xff\xff\x13\x00\x14\x00\x15\x00\x16\x00\xff\xff\xff\xff\x0b\x00\x0c\x00\x0d\x00\x0e\x00\xff\xff\x10\x00\x11\x00\x00\x00\x13\x00\x14\x00\x15\x00\x16\x00\x00\x00\x01\x00\x02\x00\x03\x00\xff\xff\xff\xff\x0b\x00\x0c\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x0d\x00\x0e\x00\x0f\x00\x10\x00\xff\xff\xff\xff\x0b\x00\x0c\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#
|
||||
|
||||
happyTable :: HappyAddr
|
||||
happyTable = HappyA# "\x00\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x2b\x00\x2b\x00\x05\x00\x46\x00\x2e\x00\x06\x00\x0e\x00\x0f\x00\x10\x00\x42\x00\x37\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x29\x00\x03\x00\x2a\x00\x04\x00\x44\x00\x03\x00\x0e\x00\x0f\x00\x10\x00\x3e\x00\x37\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x46\x00\x3d\x00\x42\x00\x3e\x00\x41\x00\x40\x00\x0e\x00\x0f\x00\x10\x00\x36\x00\x37\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x39\x00\x3a\x00\x3a\x00\x03\x00\x2e\x00\x03\x00\x0e\x00\x0f\x00\x10\x00\x44\x00\x34\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x31\x00\x03\x00\x3a\x00\xff\xff\x03\x00\x00\x00\x0e\x00\x0f\x00\x10\x00\x3b\x00\x2f\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e\x00\x0f\x00\x10\x00\x00\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x20\x00\x32\x00\x00\x00\x00\x00\x00\x00\x21\x00\x00\x00\x33\x00\x34\x00\x22\x00\x00\x00\x23\x00\x24\x00\x20\x00\x25\x00\x26\x00\x03\x00\x27\x00\x28\x00\x29\x00\x00\x00\x00\x00\x22\x00\x00\x00\x23\x00\x24\x00\x20\x00\x25\x00\x26\x00\x03\x00\x27\x00\x28\x00\x29\x00\x00\x00\x00\x00\x22\x00\x00\x00\x00\x00\x24\x00\x00\x00\x25\x00\x26\x00\x03\x00\x27\x00\x28\x00\x29\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x08\x00\x48\x00\x08\x00\x2d\x00\x08\x00\x00\x00\x00\x00\x00\x00\x35\x00\x00\x00\x00\x00\x0a\x00\x09\x00\x0a\x00\x00\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
|
||||
happyTable = HappyA# "\x00\x00\x05\x00\x06\x00\x07\x00\x08\x00\x36\x00\x09\x00\x40\x00\x5d\x00\x0a\x00\x41\x00\x0b\x00\x37\x00\x38\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x33\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x05\x00\x06\x00\x07\x00\x08\x00\x03\x00\x43\x00\x5b\x00\x03\x00\x41\x00\x04\x00\x0b\x00\x3c\x00\x56\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x30\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x05\x00\x06\x00\x07\x00\x08\x00\x43\x00\x43\x00\x31\x00\x33\x00\x03\x00\x03\x00\x5b\x00\x4d\x00\x44\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x54\x00\x3e\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x05\x00\x06\x00\x07\x00\x08\x00\x56\x00\x54\x00\x58\x00\x59\x00\x5a\x00\x4f\x00\x53\x00\x03\x00\x46\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x4c\x00\x3e\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x05\x00\x06\x00\x07\x00\x08\x00\x50\x00\x47\x00\x52\x00\x33\x00\x48\x00\x03\x00\x49\x00\xff\xff\x03\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x50\x00\x3e\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x05\x00\x06\x00\x07\x00\x08\x00\x4a\x00\x39\x00\x00\x00\x3a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x3d\x00\x3e\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x05\x00\x06\x00\x07\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x00\x00\x4a\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x05\x00\x06\x00\x07\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x00\x00\x3b\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x05\x00\x06\x00\x07\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x00\x00\x2d\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x05\x00\x06\x00\x07\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x00\x00\x34\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1e\x00\x00\x00\x1f\x00\x5f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x30\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x03\x00\x28\x00\x29\x00\x2a\x00\x1e\x00\x00\x00\x1f\x00\x5d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x30\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x03\x00\x28\x00\x29\x00\x2a\x00\x1e\x00\x00\x00\x1f\x00\x43\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x30\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x03\x00\x28\x00\x29\x00\x2a\x00\x1e\x00\x00\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x03\x00\x28\x00\x29\x00\x2a\x00\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x30\x00\x22\x00\x23\x00\x1e\x00\x25\x00\x26\x00\x00\x00\x03\x00\x28\x00\x29\x00\x2a\x00\x00\x00\x00\x00\x20\x00\x30\x00\x22\x00\x23\x00\x00\x00\x25\x00\x26\x00\x2a\x00\x03\x00\x28\x00\x29\x00\x2a\x00\x05\x00\x06\x00\x07\x00\x08\x00\x00\x00\x00\x00\x2b\x00\x4b\x00\x2a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x3a\x00\x0d\x00\x0e\x00\x0f\x00\x00\x00\x00\x00\x2b\x00\x2c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#
|
||||
|
||||
happyReduceArr = array (1, 49) [
|
||||
happyReduceArr = array (1, 60) [
|
||||
(1 , happyReduce_1),
|
||||
(2 , happyReduce_2),
|
||||
(3 , happyReduce_3),
|
||||
@@ -257,11 +275,22 @@ happyReduceArr = array (1, 49) [
|
||||
(46 , happyReduce_46),
|
||||
(47 , happyReduce_47),
|
||||
(48 , happyReduce_48),
|
||||
(49 , happyReduce_49)
|
||||
(49 , happyReduce_49),
|
||||
(50 , happyReduce_50),
|
||||
(51 , happyReduce_51),
|
||||
(52 , happyReduce_52),
|
||||
(53 , happyReduce_53),
|
||||
(54 , happyReduce_54),
|
||||
(55 , happyReduce_55),
|
||||
(56 , happyReduce_56),
|
||||
(57 , happyReduce_57),
|
||||
(58 , happyReduce_58),
|
||||
(59 , happyReduce_59),
|
||||
(60 , happyReduce_60)
|
||||
]
|
||||
|
||||
happy_n_terms = 23 :: Int
|
||||
happy_n_nonterms = 28 :: Int
|
||||
happy_n_terms = 25 :: Int
|
||||
happy_n_nonterms = 31 :: Int
|
||||
|
||||
happyReduce_1 = happySpecReduce_1 0# happyReduction_1
|
||||
happyReduction_1 happy_x_1
|
||||
@@ -364,32 +393,40 @@ happyReduction_13 happy_x_3
|
||||
happy_x_1
|
||||
= case happyOut13 happy_x_2 of { happy_var_2 ->
|
||||
happyIn12
|
||||
(Compound (reverse happy_var_2)
|
||||
(SCompound (reverse happy_var_2)
|
||||
)}
|
||||
|
||||
happyReduce_14 = happySpecReduce_2 8# happyReduction_14
|
||||
happyReduction_14 happy_x_2
|
||||
happy_x_1
|
||||
= happyIn12
|
||||
(ReturnVoid
|
||||
(SReturnVoid
|
||||
)
|
||||
|
||||
happyReduce_15 = happySpecReduce_3 8# happyReduction_15
|
||||
happyReduction_15 happy_x_3
|
||||
happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut18 happy_x_2 of { happy_var_2 ->
|
||||
= case happyOut22 happy_x_2 of { happy_var_2 ->
|
||||
happyIn12
|
||||
(Return happy_var_2
|
||||
(SReturn happy_var_2
|
||||
)}
|
||||
|
||||
happyReduce_16 = happySpecReduce_0 9# happyReduction_16
|
||||
happyReduction_16 = happyIn13
|
||||
happyReduce_16 = happySpecReduce_2 8# happyReduction_16
|
||||
happyReduction_16 happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut14 happy_x_1 of { happy_var_1 ->
|
||||
happyIn12
|
||||
(SDeclOrExpr happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_17 = happySpecReduce_0 9# happyReduction_17
|
||||
happyReduction_17 = happyIn13
|
||||
([]
|
||||
)
|
||||
|
||||
happyReduce_17 = happySpecReduce_2 9# happyReduction_17
|
||||
happyReduction_17 happy_x_2
|
||||
happyReduce_18 = happySpecReduce_2 9# happyReduction_18
|
||||
happyReduction_18 happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut13 happy_x_1 of { happy_var_1 ->
|
||||
case happyOut12 happy_x_2 of { happy_var_2 ->
|
||||
@@ -397,250 +434,342 @@ happyReduction_17 happy_x_2
|
||||
(flip (:) happy_var_1 happy_var_2
|
||||
)}}
|
||||
|
||||
happyReduce_18 = happyReduce 5# 10# happyReduction_18
|
||||
happyReduction_18 (happy_x_5 `HappyStk`
|
||||
happyReduce_19 = happySpecReduce_2 10# happyReduction_19
|
||||
happyReduction_19 happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut16 happy_x_2 of { happy_var_2 ->
|
||||
happyIn14
|
||||
(Decl happy_var_2
|
||||
)}
|
||||
|
||||
happyReduce_20 = happySpecReduce_1 10# happyReduction_20
|
||||
happyReduction_20 happy_x_1
|
||||
= case happyOut22 happy_x_1 of { happy_var_1 ->
|
||||
happyIn14
|
||||
(DExpr happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_21 = happySpecReduce_1 11# happyReduction_21
|
||||
happyReduction_21 happy_x_1
|
||||
= case happyOut4 happy_x_1 of { happy_var_1 ->
|
||||
happyIn15
|
||||
(DVar happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_22 = happySpecReduce_3 11# happyReduction_22
|
||||
happyReduction_22 happy_x_3
|
||||
happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut4 happy_x_1 of { happy_var_1 ->
|
||||
case happyOut22 happy_x_3 of { happy_var_3 ->
|
||||
happyIn15
|
||||
(DInit happy_var_1 happy_var_3
|
||||
)}}
|
||||
|
||||
happyReduce_23 = happySpecReduce_0 12# happyReduction_23
|
||||
happyReduction_23 = happyIn16
|
||||
([]
|
||||
)
|
||||
|
||||
happyReduce_24 = happySpecReduce_1 12# happyReduction_24
|
||||
happyReduction_24 happy_x_1
|
||||
= case happyOut15 happy_x_1 of { happy_var_1 ->
|
||||
happyIn16
|
||||
((:[]) happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_25 = happySpecReduce_3 12# happyReduction_25
|
||||
happyReduction_25 happy_x_3
|
||||
happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut15 happy_x_1 of { happy_var_1 ->
|
||||
case happyOut16 happy_x_3 of { happy_var_3 ->
|
||||
happyIn16
|
||||
((:) happy_var_1 happy_var_3
|
||||
)}}
|
||||
|
||||
happyReduce_26 = happySpecReduce_3 13# happyReduction_26
|
||||
happyReduction_26 happy_x_3
|
||||
happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut18 happy_x_1 of { happy_var_1 ->
|
||||
case happyOut17 happy_x_3 of { happy_var_3 ->
|
||||
happyIn17
|
||||
(EAssign happy_var_1 happy_var_3
|
||||
)}}
|
||||
|
||||
happyReduce_27 = happySpecReduce_1 13# happyReduction_27
|
||||
happyReduction_27 happy_x_1
|
||||
= case happyOut18 happy_x_1 of { happy_var_1 ->
|
||||
happyIn17
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_28 = happyReduce 5# 14# happyReduction_28
|
||||
happyReduction_28 (happy_x_5 `HappyStk`
|
||||
happy_x_4 `HappyStk`
|
||||
happy_x_3 `HappyStk`
|
||||
happy_x_2 `HappyStk`
|
||||
happy_x_1 `HappyStk`
|
||||
happyRest)
|
||||
= case happyOut4 happy_x_2 of { happy_var_2 ->
|
||||
case happyOut17 happy_x_4 of { happy_var_4 ->
|
||||
happyIn14
|
||||
case happyOut21 happy_x_4 of { happy_var_4 ->
|
||||
happyIn18
|
||||
(ENew happy_var_2 happy_var_4
|
||||
) `HappyStk` happyRest}}
|
||||
|
||||
happyReduce_19 = happySpecReduce_1 10# happyReduction_19
|
||||
happyReduction_19 happy_x_1
|
||||
= case happyOut15 happy_x_1 of { happy_var_1 ->
|
||||
happyIn14
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_20 = happySpecReduce_3 11# happyReduction_20
|
||||
happyReduction_20 happy_x_3
|
||||
happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut15 happy_x_1 of { happy_var_1 ->
|
||||
case happyOut16 happy_x_3 of { happy_var_3 ->
|
||||
happyIn15
|
||||
(EMember happy_var_1 happy_var_3
|
||||
)}}
|
||||
|
||||
happyReduce_21 = happyReduce 4# 11# happyReduction_21
|
||||
happyReduction_21 (happy_x_4 `HappyStk`
|
||||
happy_x_3 `HappyStk`
|
||||
happy_x_2 `HappyStk`
|
||||
happy_x_1 `HappyStk`
|
||||
happyRest)
|
||||
= case happyOut15 happy_x_1 of { happy_var_1 ->
|
||||
case happyOut18 happy_x_3 of { happy_var_3 ->
|
||||
happyIn15
|
||||
(EIndex happy_var_1 happy_var_3
|
||||
) `HappyStk` happyRest}}
|
||||
|
||||
happyReduce_22 = happyReduce 4# 11# happyReduction_22
|
||||
happyReduction_22 (happy_x_4 `HappyStk`
|
||||
happy_x_3 `HappyStk`
|
||||
happy_x_2 `HappyStk`
|
||||
happy_x_1 `HappyStk`
|
||||
happyRest)
|
||||
= case happyOut15 happy_x_1 of { happy_var_1 ->
|
||||
case happyOut17 happy_x_3 of { happy_var_3 ->
|
||||
happyIn15
|
||||
(ECall happy_var_1 happy_var_3
|
||||
) `HappyStk` happyRest}}
|
||||
|
||||
happyReduce_23 = happySpecReduce_1 11# happyReduction_23
|
||||
happyReduction_23 happy_x_1
|
||||
= case happyOut16 happy_x_1 of { happy_var_1 ->
|
||||
happyIn15
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_24 = happySpecReduce_1 12# happyReduction_24
|
||||
happyReduction_24 happy_x_1
|
||||
= case happyOut4 happy_x_1 of { happy_var_1 ->
|
||||
happyIn16
|
||||
(EVar happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_25 = happySpecReduce_1 12# happyReduction_25
|
||||
happyReduction_25 happy_x_1
|
||||
= case happyOut5 happy_x_1 of { happy_var_1 ->
|
||||
happyIn16
|
||||
(EInt happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_26 = happySpecReduce_1 12# happyReduction_26
|
||||
happyReduction_26 happy_x_1
|
||||
= case happyOut6 happy_x_1 of { happy_var_1 ->
|
||||
happyIn16
|
||||
(EDbl happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_27 = happySpecReduce_1 12# happyReduction_27
|
||||
happyReduction_27 happy_x_1
|
||||
= case happyOut7 happy_x_1 of { happy_var_1 ->
|
||||
happyIn16
|
||||
(EStr happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_28 = happySpecReduce_1 12# happyReduction_28
|
||||
happyReduction_28 happy_x_1
|
||||
= happyIn16
|
||||
(ETrue
|
||||
)
|
||||
|
||||
happyReduce_29 = happySpecReduce_1 12# happyReduction_29
|
||||
happyReduce_29 = happySpecReduce_1 14# happyReduction_29
|
||||
happyReduction_29 happy_x_1
|
||||
= happyIn16
|
||||
(EFalse
|
||||
)
|
||||
|
||||
happyReduce_30 = happySpecReduce_1 12# happyReduction_30
|
||||
happyReduction_30 happy_x_1
|
||||
= happyIn16
|
||||
(ENull
|
||||
)
|
||||
|
||||
happyReduce_31 = happySpecReduce_1 12# happyReduction_31
|
||||
happyReduction_31 happy_x_1
|
||||
= happyIn16
|
||||
(EThis
|
||||
)
|
||||
|
||||
happyReduce_32 = happySpecReduce_3 12# happyReduction_32
|
||||
happyReduction_32 happy_x_3
|
||||
happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut18 happy_x_2 of { happy_var_2 ->
|
||||
happyIn16
|
||||
(happy_var_2
|
||||
)}
|
||||
|
||||
happyReduce_33 = happySpecReduce_0 13# happyReduction_33
|
||||
happyReduction_33 = happyIn17
|
||||
([]
|
||||
)
|
||||
|
||||
happyReduce_34 = happySpecReduce_1 13# happyReduction_34
|
||||
happyReduction_34 happy_x_1
|
||||
= case happyOut18 happy_x_1 of { happy_var_1 ->
|
||||
happyIn17
|
||||
((:[]) happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_35 = happySpecReduce_3 13# happyReduction_35
|
||||
happyReduction_35 happy_x_3
|
||||
happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut18 happy_x_1 of { happy_var_1 ->
|
||||
case happyOut17 happy_x_3 of { happy_var_3 ->
|
||||
happyIn17
|
||||
((:) happy_var_1 happy_var_3
|
||||
)}}
|
||||
|
||||
happyReduce_36 = happySpecReduce_1 14# happyReduction_36
|
||||
happyReduction_36 happy_x_1
|
||||
= case happyOut19 happy_x_1 of { happy_var_1 ->
|
||||
happyIn18
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_37 = happySpecReduce_1 15# happyReduction_37
|
||||
happyReduction_37 happy_x_1
|
||||
happyReduce_30 = happySpecReduce_3 15# happyReduction_30
|
||||
happyReduction_30 happy_x_3
|
||||
happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut19 happy_x_1 of { happy_var_1 ->
|
||||
case happyOut4 happy_x_3 of { happy_var_3 ->
|
||||
happyIn19
|
||||
(EMember happy_var_1 happy_var_3
|
||||
)}}
|
||||
|
||||
happyReduce_31 = happyReduce 4# 15# happyReduction_31
|
||||
happyReduction_31 (happy_x_4 `HappyStk`
|
||||
happy_x_3 `HappyStk`
|
||||
happy_x_2 `HappyStk`
|
||||
happy_x_1 `HappyStk`
|
||||
happyRest)
|
||||
= case happyOut19 happy_x_1 of { happy_var_1 ->
|
||||
case happyOut22 happy_x_3 of { happy_var_3 ->
|
||||
happyIn19
|
||||
(EIndex happy_var_1 happy_var_3
|
||||
) `HappyStk` happyRest}}
|
||||
|
||||
happyReduce_32 = happyReduce 4# 15# happyReduction_32
|
||||
happyReduction_32 (happy_x_4 `HappyStk`
|
||||
happy_x_3 `HappyStk`
|
||||
happy_x_2 `HappyStk`
|
||||
happy_x_1 `HappyStk`
|
||||
happyRest)
|
||||
= case happyOut19 happy_x_1 of { happy_var_1 ->
|
||||
case happyOut21 happy_x_3 of { happy_var_3 ->
|
||||
happyIn19
|
||||
(ECall happy_var_1 happy_var_3
|
||||
) `HappyStk` happyRest}}
|
||||
|
||||
happyReduce_33 = happySpecReduce_1 15# happyReduction_33
|
||||
happyReduction_33 happy_x_1
|
||||
= case happyOut20 happy_x_1 of { happy_var_1 ->
|
||||
happyIn19
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_34 = happySpecReduce_1 16# happyReduction_34
|
||||
happyReduction_34 happy_x_1
|
||||
= case happyOut4 happy_x_1 of { happy_var_1 ->
|
||||
happyIn20
|
||||
(EVar happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_35 = happySpecReduce_1 16# happyReduction_35
|
||||
happyReduction_35 happy_x_1
|
||||
= case happyOut5 happy_x_1 of { happy_var_1 ->
|
||||
happyIn20
|
||||
(EInt happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_36 = happySpecReduce_1 16# happyReduction_36
|
||||
happyReduction_36 happy_x_1
|
||||
= case happyOut6 happy_x_1 of { happy_var_1 ->
|
||||
happyIn20
|
||||
(EDbl happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_37 = happySpecReduce_1 16# happyReduction_37
|
||||
happyReduction_37 happy_x_1
|
||||
= case happyOut7 happy_x_1 of { happy_var_1 ->
|
||||
happyIn20
|
||||
(EStr happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_38 = happySpecReduce_1 16# happyReduction_38
|
||||
happyReduction_38 happy_x_1
|
||||
= case happyOut21 happy_x_1 of { happy_var_1 ->
|
||||
= happyIn20
|
||||
(ETrue
|
||||
)
|
||||
|
||||
happyReduce_39 = happySpecReduce_1 16# happyReduction_39
|
||||
happyReduction_39 happy_x_1
|
||||
= happyIn20
|
||||
(EFalse
|
||||
)
|
||||
|
||||
happyReduce_40 = happySpecReduce_1 16# happyReduction_40
|
||||
happyReduction_40 happy_x_1
|
||||
= happyIn20
|
||||
(ENull
|
||||
)
|
||||
|
||||
happyReduce_41 = happySpecReduce_1 16# happyReduction_41
|
||||
happyReduction_41 happy_x_1
|
||||
= happyIn20
|
||||
(EThis
|
||||
)
|
||||
|
||||
happyReduce_42 = happyReduce 7# 16# happyReduction_42
|
||||
happyReduction_42 (happy_x_7 `HappyStk`
|
||||
happy_x_6 `HappyStk`
|
||||
happy_x_5 `HappyStk`
|
||||
happy_x_4 `HappyStk`
|
||||
happy_x_3 `HappyStk`
|
||||
happy_x_2 `HappyStk`
|
||||
happy_x_1 `HappyStk`
|
||||
happyRest)
|
||||
= case happyOut11 happy_x_3 of { happy_var_3 ->
|
||||
case happyOut13 happy_x_6 of { happy_var_6 ->
|
||||
happyIn20
|
||||
(happy_var_1
|
||||
(EFun happy_var_3 (reverse happy_var_6)
|
||||
) `HappyStk` happyRest}}
|
||||
|
||||
happyReduce_43 = happyReduce 5# 16# happyReduction_43
|
||||
happyReduction_43 (happy_x_5 `HappyStk`
|
||||
happy_x_4 `HappyStk`
|
||||
happy_x_3 `HappyStk`
|
||||
happy_x_2 `HappyStk`
|
||||
happy_x_1 `HappyStk`
|
||||
happyRest)
|
||||
= case happyOut22 happy_x_2 of { happy_var_2 ->
|
||||
case happyOut21 happy_x_4 of { happy_var_4 ->
|
||||
happyIn20
|
||||
(eseq1_ happy_var_2 happy_var_4
|
||||
) `HappyStk` happyRest}}
|
||||
|
||||
happyReduce_44 = happySpecReduce_3 16# happyReduction_44
|
||||
happyReduction_44 happy_x_3
|
||||
happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut22 happy_x_2 of { happy_var_2 ->
|
||||
happyIn20
|
||||
(happy_var_2
|
||||
)}
|
||||
|
||||
happyReduce_39 = happySpecReduce_1 17# happyReduction_39
|
||||
happyReduction_39 happy_x_1
|
||||
happyReduce_45 = happySpecReduce_0 17# happyReduction_45
|
||||
happyReduction_45 = happyIn21
|
||||
([]
|
||||
)
|
||||
|
||||
happyReduce_46 = happySpecReduce_1 17# happyReduction_46
|
||||
happyReduction_46 happy_x_1
|
||||
= case happyOut22 happy_x_1 of { happy_var_1 ->
|
||||
happyIn21
|
||||
(happy_var_1
|
||||
((:[]) happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_40 = happySpecReduce_1 18# happyReduction_40
|
||||
happyReduction_40 happy_x_1
|
||||
happyReduce_47 = happySpecReduce_3 17# happyReduction_47
|
||||
happyReduction_47 happy_x_3
|
||||
happy_x_2
|
||||
happy_x_1
|
||||
= case happyOut22 happy_x_1 of { happy_var_1 ->
|
||||
case happyOut21 happy_x_3 of { happy_var_3 ->
|
||||
happyIn21
|
||||
((:) happy_var_1 happy_var_3
|
||||
)}}
|
||||
|
||||
happyReduce_48 = happySpecReduce_1 18# happyReduction_48
|
||||
happyReduction_48 happy_x_1
|
||||
= case happyOut23 happy_x_1 of { happy_var_1 ->
|
||||
happyIn22
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_41 = happySpecReduce_1 19# happyReduction_41
|
||||
happyReduction_41 happy_x_1
|
||||
happyReduce_49 = happySpecReduce_1 19# happyReduction_49
|
||||
happyReduction_49 happy_x_1
|
||||
= case happyOut24 happy_x_1 of { happy_var_1 ->
|
||||
happyIn23
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_42 = happySpecReduce_1 20# happyReduction_42
|
||||
happyReduction_42 happy_x_1
|
||||
happyReduce_50 = happySpecReduce_1 20# happyReduction_50
|
||||
happyReduction_50 happy_x_1
|
||||
= case happyOut25 happy_x_1 of { happy_var_1 ->
|
||||
happyIn24
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_43 = happySpecReduce_1 21# happyReduction_43
|
||||
happyReduction_43 happy_x_1
|
||||
happyReduce_51 = happySpecReduce_1 21# happyReduction_51
|
||||
happyReduction_51 happy_x_1
|
||||
= case happyOut26 happy_x_1 of { happy_var_1 ->
|
||||
happyIn25
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_44 = happySpecReduce_1 22# happyReduction_44
|
||||
happyReduction_44 happy_x_1
|
||||
happyReduce_52 = happySpecReduce_1 22# happyReduction_52
|
||||
happyReduction_52 happy_x_1
|
||||
= case happyOut27 happy_x_1 of { happy_var_1 ->
|
||||
happyIn26
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_45 = happySpecReduce_1 23# happyReduction_45
|
||||
happyReduction_45 happy_x_1
|
||||
happyReduce_53 = happySpecReduce_1 23# happyReduction_53
|
||||
happyReduction_53 happy_x_1
|
||||
= case happyOut28 happy_x_1 of { happy_var_1 ->
|
||||
happyIn27
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_46 = happySpecReduce_1 24# happyReduction_46
|
||||
happyReduction_46 happy_x_1
|
||||
happyReduce_54 = happySpecReduce_1 24# happyReduction_54
|
||||
happyReduction_54 happy_x_1
|
||||
= case happyOut29 happy_x_1 of { happy_var_1 ->
|
||||
happyIn28
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_47 = happySpecReduce_1 25# happyReduction_47
|
||||
happyReduction_47 happy_x_1
|
||||
happyReduce_55 = happySpecReduce_1 25# happyReduction_55
|
||||
happyReduction_55 happy_x_1
|
||||
= case happyOut30 happy_x_1 of { happy_var_1 ->
|
||||
happyIn29
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_48 = happySpecReduce_1 26# happyReduction_48
|
||||
happyReduction_48 happy_x_1
|
||||
happyReduce_56 = happySpecReduce_1 26# happyReduction_56
|
||||
happyReduction_56 happy_x_1
|
||||
= case happyOut31 happy_x_1 of { happy_var_1 ->
|
||||
happyIn30
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_49 = happySpecReduce_1 27# happyReduction_49
|
||||
happyReduction_49 happy_x_1
|
||||
= case happyOut14 happy_x_1 of { happy_var_1 ->
|
||||
happyReduce_57 = happySpecReduce_1 27# happyReduction_57
|
||||
happyReduction_57 happy_x_1
|
||||
= case happyOut32 happy_x_1 of { happy_var_1 ->
|
||||
happyIn31
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_58 = happySpecReduce_1 28# happyReduction_58
|
||||
happyReduction_58 happy_x_1
|
||||
= case happyOut33 happy_x_1 of { happy_var_1 ->
|
||||
happyIn32
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_59 = happySpecReduce_1 29# happyReduction_59
|
||||
happyReduction_59 happy_x_1
|
||||
= case happyOut34 happy_x_1 of { happy_var_1 ->
|
||||
happyIn33
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyReduce_60 = happySpecReduce_1 30# happyReduction_60
|
||||
happyReduction_60 happy_x_1
|
||||
= case happyOut17 happy_x_1 of { happy_var_1 ->
|
||||
happyIn34
|
||||
(happy_var_1
|
||||
)}
|
||||
|
||||
happyNewToken action sts stk [] =
|
||||
happyDoAction 22# notHappyAtAll action sts stk []
|
||||
happyDoAction 24# notHappyAtAll action sts stk []
|
||||
|
||||
happyNewToken action sts stk (tk:tks) =
|
||||
let cont i = happyDoAction i tk action sts stk tks in
|
||||
@@ -651,21 +780,23 @@ happyNewToken action sts stk (tk:tks) =
|
||||
PT _ (TS "}") -> cont 4#;
|
||||
PT _ (TS ",") -> cont 5#;
|
||||
PT _ (TS ";") -> cont 6#;
|
||||
PT _ (TS ".") -> cont 7#;
|
||||
PT _ (TS "[") -> cont 8#;
|
||||
PT _ (TS "]") -> cont 9#;
|
||||
PT _ (TS "false") -> cont 10#;
|
||||
PT _ (TS "function") -> cont 11#;
|
||||
PT _ (TS "new") -> cont 12#;
|
||||
PT _ (TS "null") -> cont 13#;
|
||||
PT _ (TS "return") -> cont 14#;
|
||||
PT _ (TS "this") -> cont 15#;
|
||||
PT _ (TS "true") -> cont 16#;
|
||||
PT _ (TV happy_dollar_dollar) -> cont 17#;
|
||||
PT _ (TI happy_dollar_dollar) -> cont 18#;
|
||||
PT _ (TD happy_dollar_dollar) -> cont 19#;
|
||||
PT _ (TL happy_dollar_dollar) -> cont 20#;
|
||||
_ -> cont 21#;
|
||||
PT _ (TS "=") -> cont 7#;
|
||||
PT _ (TS ".") -> cont 8#;
|
||||
PT _ (TS "[") -> cont 9#;
|
||||
PT _ (TS "]") -> cont 10#;
|
||||
PT _ (TS "false") -> cont 11#;
|
||||
PT _ (TS "function") -> cont 12#;
|
||||
PT _ (TS "new") -> cont 13#;
|
||||
PT _ (TS "null") -> cont 14#;
|
||||
PT _ (TS "return") -> cont 15#;
|
||||
PT _ (TS "this") -> cont 16#;
|
||||
PT _ (TS "true") -> cont 17#;
|
||||
PT _ (TS "var") -> cont 18#;
|
||||
PT _ (TV happy_dollar_dollar) -> cont 19#;
|
||||
PT _ (TI happy_dollar_dollar) -> cont 20#;
|
||||
PT _ (TD happy_dollar_dollar) -> cont 21#;
|
||||
PT _ (TL happy_dollar_dollar) -> cont 22#;
|
||||
_ -> cont 23#;
|
||||
_ -> happyError' (tk:tks)
|
||||
}
|
||||
|
||||
@@ -702,6 +833,7 @@ happyError ts =
|
||||
_ -> " before " ++ unwords (map prToken (take 4 ts))
|
||||
|
||||
myLexer = tokens
|
||||
eseq1_ x_ xs_ = ESeq (x_ : xs_)
|
||||
{-# LINE 1 "GenericTemplate.hs" #-}
|
||||
{-# LINE 1 "<built-in>" #-}
|
||||
{-# LINE 1 "<command line>" #-}
|
||||
|
||||
@@ -122,6 +122,7 @@ Expr16 : Ident { EVar $1 }
|
||||
| 'null' { ENull }
|
||||
| 'this' { EThis }
|
||||
| 'function' '(' ListIdent ')' '{' ListStmt '}' { EFun $3 (reverse $6) }
|
||||
| '(' Expr ',' ListExpr ')' { eseq1_ $2 $4 }
|
||||
| '(' Expr ')' { $2 }
|
||||
|
||||
|
||||
@@ -201,5 +202,6 @@ happyError ts =
|
||||
_ -> " before " ++ unwords (map prToken (take 4 ts))
|
||||
|
||||
myLexer = tokens
|
||||
eseq1_ x_ xs_ = ESeq (x_ : xs_)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{-# OPTIONS -fno-warn-incomplete-patterns #-}
|
||||
module GF.JavaScript.PrintJS where
|
||||
module GF.JavaScript.PrintJS (printTree, Doc, Print(..)) where
|
||||
|
||||
-- pretty-printer generated by the BNF converter
|
||||
|
||||
@@ -25,8 +25,10 @@ render d = rend 0 (map ($ "") $ d []) "" where
|
||||
"}" :ts -> new (i-1) . showChar '}' . new (i-1) . rend (i-1) ts
|
||||
";" :ts -> showChar ';' . new i . rend i ts
|
||||
t : "," :ts -> showString t . space "," . rend i ts
|
||||
t : "." :ts -> showString t . showString "." . rend i ts
|
||||
t : ")" :ts -> showString t . showChar ')' . rend i ts
|
||||
t : "]" :ts -> showString t . showChar ']' . rend i ts
|
||||
t : "[" :ts -> showString t . showChar '[' . rend i ts
|
||||
t :ts -> space t . rend i ts
|
||||
_ -> id
|
||||
new i = showChar '\n' . replicateS (2*i) (showChar ' ') . dropWhile isSpace
|
||||
@@ -143,6 +145,7 @@ instance Print Expr where
|
||||
ENull -> prPrec i 16 (concatD [doc (showString "null")])
|
||||
EThis -> prPrec i 16 (concatD [doc (showString "this")])
|
||||
EFun ids stmts -> prPrec i 16 (concatD [doc (showString "function") , doc (showString "(") , prt 0 ids , doc (showString ")") , doc (showString "{") , prt 0 stmts , doc (showString "}")])
|
||||
ESeq exprs -> prPrec i 16 (concatD [doc (showString "(") , prt 0 exprs , doc (showString ")")])
|
||||
|
||||
prtList es = case es of
|
||||
[] -> (concatD [])
|
||||
|
||||
@@ -61,6 +61,7 @@ transExpr x = case x of
|
||||
ENull -> failure x
|
||||
EThis -> failure x
|
||||
EFun ids stmts -> failure x
|
||||
ESeq exprs -> failure x
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ makeRegular g = groupProds $ concatMap trSet (mutRecCats True g)
|
||||
| otherwise = concatMap handleCat csl
|
||||
where csl = Set.toList cs
|
||||
rs = catSetRules g cs
|
||||
handleCat c = [CFRule c' [] (mkName (c++"-empty"))] -- introduce A' -> e
|
||||
handleCat c = [CFRule c' [] (mkCFTerm (c++"-empty"))] -- introduce A' -> e
|
||||
++ concatMap (makeRightLinearRules c) (catRules g c)
|
||||
where c' = newCat c
|
||||
makeRightLinearRules b' (CFRule c ss n) =
|
||||
|
||||
@@ -22,7 +22,7 @@ module GF.Speech.PrJSGF (jsgfPrinter) where
|
||||
import GF.Conversion.Types
|
||||
import GF.Data.Utilities
|
||||
import GF.Formalism.CFG
|
||||
import GF.Formalism.Utilities (Symbol(..), NameProfile(..), Profile(..))
|
||||
import GF.Formalism.Utilities (Symbol(..), NameProfile(..), Profile(..), filterCats)
|
||||
import GF.Infra.Ident
|
||||
import GF.Infra.Print
|
||||
import GF.Infra.Option
|
||||
@@ -31,6 +31,7 @@ import GF.Speech.SISR
|
||||
import GF.Speech.SRG
|
||||
import GF.Speech.RegExp
|
||||
|
||||
import Data.Char
|
||||
import Data.List
|
||||
import Debug.Trace
|
||||
|
||||
@@ -45,7 +46,7 @@ jsgfPrinter name start opts sisr probs cfg = prJSGF srg sisr ""
|
||||
|
||||
prJSGF :: SRG -> Maybe SISRFormat -> ShowS
|
||||
prJSGF srg@(SRG{grammarName=name,startCat=start,origStartCat=origStart,rules=rs}) sisr
|
||||
= header . nl
|
||||
= trace (show srg) $ header . nl
|
||||
. mainCat . nl
|
||||
. unlinesS topCatRules . nl
|
||||
. unlinesS (map prRule rs)
|
||||
@@ -58,12 +59,17 @@ prJSGF srg@(SRG{grammarName=name,startCat=start,origStartCat=origStart,rules=rs}
|
||||
. rule True "MAIN" [prCat start]
|
||||
prRule (SRGRule cat origCat rhs) =
|
||||
comment origCat
|
||||
. rule False cat (map prAlt (ebnfSRGAlts rhs))
|
||||
-- . rule False cat (map prAlt (ebnfSRGAlts rhs))
|
||||
. rule False cat (map prAlt rhs)
|
||||
-- FIXME: use the probability
|
||||
prAlt (EBnfSRGAlt mp n rhs) = tag sisr (profileInitSISR n) . showChar ' '. prItem sisr rhs
|
||||
-- prAlt (EBnfSRGAlt mp n rhs) = tag sisr (profileInitSISR n) . showChar ' '. prItem sisr rhs
|
||||
prAlt (SRGAlt mp n rhs) = initTag . showChar ' '. prItem sisr n rhs . tag sisr (profileFinalSISR n)
|
||||
where initTag | null (t "") = id
|
||||
| otherwise = showString "<NULL>" . showChar ' ' . t
|
||||
where t = tag sisr (profileInitSISR n)
|
||||
|
||||
topCatRules = [rule True (catFormId tc) (map (it tc) cs) | (tc,cs) <- srgTopCats srg]
|
||||
where it i c = prCat c . tag sisr [(EThis :. catFieldId i) := (ERef c)]
|
||||
where it i c = prCat c . tag sisr (topCatSISR (catFieldId i) c)
|
||||
|
||||
catFormId :: String -> String
|
||||
catFormId = (++ "_cat")
|
||||
@@ -74,6 +80,7 @@ catFieldId = (++ "_field")
|
||||
prCat :: SRGCat -> ShowS
|
||||
prCat c = showChar '<' . showString c . showChar '>'
|
||||
|
||||
{-
|
||||
prItem :: Maybe SISRFormat -> EBnfSRGItem -> ShowS
|
||||
prItem sisr = f 1
|
||||
where
|
||||
@@ -86,16 +93,26 @@ prItem sisr = f 1
|
||||
f p (REConcat xs) = (if p >= 3 then paren else id) (unwordsS (map (f 2) xs))
|
||||
f p (RERepeat x) = f 3 x . showString "*"
|
||||
f _ (RESymbol s) = prSymbol sisr s
|
||||
-}
|
||||
|
||||
prSymbol :: Maybe SISRFormat -> Symbol SRGNT Token -> ShowS
|
||||
prSymbol sisr (Cat n@(c,_)) = prCat c . tag sisr (catSISR n)
|
||||
prSymbol _ (Tok t) | all isPunct (prt t) = id -- removes punctuation
|
||||
| otherwise = prtS t -- FIXME: quote if there is whitespace or odd chars
|
||||
prItem :: Maybe SISRFormat -> CFTerm -> [Symbol SRGNT Token] -> ShowS
|
||||
prItem _ _ [] = showString "<NULL>"
|
||||
prItem sisr cn ss = paren $ unwordsS $ map (prSymbol sisr cn) ss
|
||||
|
||||
tag :: Maybe SISRFormat -> [SISRExpr] -> ShowS
|
||||
prSymbol :: Maybe SISRFormat -> CFTerm -> Symbol SRGNT Token -> ShowS
|
||||
prSymbol sisr cn (Cat n@(c,_)) = prCat c . tag sisr (catSISR cn n)
|
||||
prSymbol _ cn (Tok t) | all isPunct (prt t) = id -- removes punctuation
|
||||
| otherwise = prtS t -- FIXME: quote if there is whitespace or odd chars
|
||||
|
||||
tag :: Maybe SISRFormat -> (SISRFormat -> SISRTag) -> ShowS
|
||||
tag Nothing _ = id
|
||||
tag _ [] = id
|
||||
tag (Just fmt) t = showString "{" . showString (prSISR fmt t) . showString "}"
|
||||
tag (Just fmt) t = case t fmt of
|
||||
[] -> id
|
||||
ts -> showString "{" . showString (e $ prSISR ts) . showString "}"
|
||||
where e [] = []
|
||||
e ('}':xs) = '\\':'}':e xs
|
||||
e ('\n':xs) = ' ' : e (dropWhile isSpace xs)
|
||||
e (x:xs) = x:e xs
|
||||
|
||||
isPunct :: Char -> Bool
|
||||
isPunct c = c `elem` "-_.;.,?!"
|
||||
|
||||
@@ -22,7 +22,7 @@ import GF.Infra.Ident
|
||||
import GF.Today
|
||||
|
||||
import GF.Formalism.CFG
|
||||
import GF.Formalism.Utilities (Symbol(..), NameProfile(..), Profile(..), forestName)
|
||||
import GF.Formalism.Utilities (Symbol(..), NameProfile(..), Profile(..), forestName, filterCats)
|
||||
import GF.Conversion.Types
|
||||
import GF.Infra.Print
|
||||
import GF.Infra.Option
|
||||
@@ -59,17 +59,18 @@ prSrgsXml sisr srg@(SRG{grammarName=name,startCat=start,
|
||||
++ topCatRules
|
||||
++ concatMap ruleToXML rs
|
||||
ruleToXML (SRGRule cat origCat alts) =
|
||||
comments ["Category " ++ origCat] ++ [rule cat (prRhs $ ebnfSRGAlts alts)]
|
||||
comments ["Category " ++ origCat] ++ [rule cat (prRhs alts)]
|
||||
prRhs rhss = [oneOf (map (mkProd sisr) rhss)]
|
||||
-- externally visible rules for each of the GF categories
|
||||
topCatRules = [topRule tc [oneOf (map (it tc) cs)] | (tc,cs) <- srgTopCats srg]
|
||||
where it i c = Tag "item" [] [Tag "ruleref" [("uri","#" ++ c)] [],
|
||||
tag sisr [(EThis :. catFieldId i) := (ERef c)]]
|
||||
tag sisr (topCatSISR (catFieldId i) c)]
|
||||
topRule i is = Tag "rule" [("id",catFormId i),("scope","public")] is
|
||||
|
||||
rule :: String -> [XML] -> XML
|
||||
rule i = Tag "rule" [("id",i)]
|
||||
|
||||
{-
|
||||
mkProd :: Maybe SISRFormat -> EBnfSRGAlt -> XML
|
||||
mkProd sisr (EBnfSRGAlt mp n rhs) = Tag "item" w (t ++ xs)
|
||||
where xs = [mkItem sisr rhs]
|
||||
@@ -83,17 +84,29 @@ mkItem sisr = f
|
||||
f (REConcat xs) = Tag "item" [] (map f xs)
|
||||
f (RERepeat x) = Tag "item" [("repeat","0-")] [f x]
|
||||
f (RESymbol s) = symItem sisr s
|
||||
-}
|
||||
|
||||
symItem :: Maybe SISRFormat -> Symbol SRGNT Token -> XML
|
||||
symItem sisr (Cat n@(c,_)) =
|
||||
Tag "item" [] [Tag "ruleref" [("uri","#" ++ c)] [], tag sisr (catSISR n)]
|
||||
symItem _ (Tok t) = Tag "item" [] [Data (showToken t)]
|
||||
mkProd :: Maybe SISRFormat -> SRGAlt -> XML
|
||||
mkProd sisr (SRGAlt mp n rhs) = Tag "item" w (ti ++ xs ++ tf)
|
||||
where xs = mkItem sisr n rhs
|
||||
w = maybe [] (\p -> [("weight", show p)]) mp
|
||||
ti = [tag sisr (profileInitSISR n)]
|
||||
tf = [tag sisr (profileFinalSISR n)]
|
||||
|
||||
tag :: Maybe SISRFormat -> [SISRExpr] -> XML
|
||||
|
||||
mkItem :: Maybe SISRFormat -> CFTerm -> [Symbol SRGNT Token] -> [XML]
|
||||
mkItem sisr cn ss = map (symItem sisr cn) ss
|
||||
|
||||
symItem :: Maybe SISRFormat -> CFTerm -> Symbol SRGNT Token -> XML
|
||||
symItem sisr cn (Cat n@(c,_)) =
|
||||
Tag "item" [] $ [Tag "ruleref" [("uri","#" ++ c)] [], tag sisr (catSISR cn n)]
|
||||
symItem _ _ (Tok t) = Tag "item" [] [Data (showToken t)]
|
||||
|
||||
tag :: Maybe SISRFormat -> (SISRFormat -> SISRTag) -> XML
|
||||
tag Nothing _ = Empty
|
||||
tag _ [] = Empty
|
||||
tag (Just fmt) ts = Tag "tag" [] [Data (prSISR fmt ts)]
|
||||
|
||||
tag (Just fmt) t = case t fmt of
|
||||
[] -> Empty
|
||||
ts -> Tag "tag" [] [Data (prSISR ts)]
|
||||
|
||||
catFormId :: String -> String
|
||||
catFormId = (++ "_cat")
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
--
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
module GF.Speech.SISR (SISRFormat(..), SISRExpr(..), prSISR,
|
||||
profileInitSISR, catSISR) where
|
||||
module GF.Speech.SISR (SISRFormat(..), SISRTag, prSISR,
|
||||
topCatSISR, profileInitSISR, catSISR, profileFinalSISR) where
|
||||
|
||||
import Data.List
|
||||
|
||||
@@ -20,11 +20,11 @@ import GF.Data.Utilities
|
||||
import GF.Formalism.CFG
|
||||
import GF.Formalism.Utilities (Symbol(..), NameProfile(..), Profile(..), forestName)
|
||||
import GF.Infra.Ident
|
||||
import GF.Speech.TransformCFG
|
||||
import GF.Speech.SRG
|
||||
|
||||
|
||||
infixl 8 :.
|
||||
infixr 1 :=
|
||||
import qualified GF.JavaScript.AbsJS as JS
|
||||
import qualified GF.JavaScript.PrintJS as JS
|
||||
|
||||
data SISRFormat =
|
||||
-- SISR Working draft 1 April 2003
|
||||
@@ -32,35 +32,57 @@ data SISRFormat =
|
||||
SISROld
|
||||
deriving Show
|
||||
|
||||
data SISRExpr = SISRExpr := SISRExpr
|
||||
| EThis
|
||||
| SISRExpr :. String
|
||||
| ERef String
|
||||
| EStr String
|
||||
| EApp SISRExpr [SISRExpr]
|
||||
| ENew String [SISRExpr]
|
||||
deriving Show
|
||||
type SISRTag = [JS.Expr]
|
||||
|
||||
prSISR :: SISRFormat -> [SISRExpr] -> String
|
||||
prSISR fmt = join "; " . map f
|
||||
where
|
||||
f e =
|
||||
case e of
|
||||
x := y -> f x ++ "=" ++ f y
|
||||
EThis -> "$"
|
||||
x :. y -> f x ++ "." ++ y
|
||||
ERef y -> "$" ++ y
|
||||
EStr s -> show s
|
||||
EApp x ys -> f x ++ "(" ++ concat (intersperse "," (map f ys)) ++ ")"
|
||||
ENew n ys -> "new " ++ n ++ "(" ++ concat (intersperse "," (map f ys)) ++ ")"
|
||||
|
||||
profileInitSISR :: Name -> [SISRExpr]
|
||||
profileInitSISR (Name f prs) =
|
||||
[(EThis :. "name") := (EStr (prIdent f))] ++
|
||||
[(EThis :. ("arg" ++ show n)) := (EStr (argInit (prs!!n)))
|
||||
| n <- [0..length prs-1]]
|
||||
where argInit (Unify _) = "?"
|
||||
argInit (Constant f) = maybe "?" prIdent (forestName f)
|
||||
prSISR :: SISRTag -> String
|
||||
prSISR = JS.printTree
|
||||
|
||||
catSISR :: SRGNT -> [SISRExpr]
|
||||
catSISR (c,slots) = [(EThis :. ("arg" ++ show s)) := (ERef c) | s <- slots]
|
||||
topCatSISR :: String -> String -> SISRFormat -> SISRTag
|
||||
topCatSISR i c fmt = [field (fmtOut fmt) i `ass` fmtRef fmt c]
|
||||
|
||||
profileInitSISR :: CFTerm -> SISRFormat -> SISRTag
|
||||
profileInitSISR t fmt
|
||||
| null (usedChildren t) = []
|
||||
| otherwise = [children `ass` JS.ENew (JS.Ident "Array") []]
|
||||
|
||||
usedChildren :: CFTerm -> [Int]
|
||||
usedChildren (CFObj _ ts) = foldr union [] (map usedChildren ts)
|
||||
usedChildren (CFAbs _ x) = usedChildren x
|
||||
usedChildren (CFApp x y) = usedChildren x `union` usedChildren y
|
||||
usedChildren (CFRes i) = [i]
|
||||
usedChildren _ = []
|
||||
|
||||
catSISR :: CFTerm -> SRGNT -> SISRFormat -> SISRTag
|
||||
catSISR t (c,i) fmt
|
||||
| i `elem` usedChildren t =
|
||||
[JS.EIndex children (JS.EInt (fromIntegral i)) `ass` fmtRef fmt c]
|
||||
| otherwise = []
|
||||
|
||||
profileFinalSISR :: CFTerm -> SISRFormat -> SISRTag
|
||||
profileFinalSISR term fmt = [fmtOut fmt `ass` f term]
|
||||
where f (CFObj n ts) =
|
||||
JS.ESeq $ [ret `ass` JS.ENew (JS.Ident "Object") [],
|
||||
field ret "name" `ass` JS.EStr (prIdent n)]
|
||||
++ [field ret ("arg"++show i) `ass` f t
|
||||
| (i,t) <- zip [0..] ts ]
|
||||
++ [ret]
|
||||
where ret = JS.EVar (JS.Ident "ret")
|
||||
f (CFAbs v x) = JS.EFun [var v] [JS.SReturn (f x)]
|
||||
f (CFApp x y) = JS.ECall (f x) [f y]
|
||||
f (CFRes i) = JS.EIndex children (JS.EInt (fromIntegral i))
|
||||
f (CFVar v) = JS.EVar (var v)
|
||||
f (CFConst s) = JS.EStr s
|
||||
|
||||
|
||||
fmtOut SISROld = JS.EVar (JS.Ident "$")
|
||||
|
||||
fmtRef SISROld c = JS.EVar (JS.Ident ("$" ++ c))
|
||||
|
||||
children = JS.EVar (JS.Ident "c")
|
||||
|
||||
var v = JS.Ident ("x" ++ show v)
|
||||
|
||||
field x y = JS.EMember x (JS.Ident y)
|
||||
|
||||
ass = JS.EAssign
|
||||
@@ -19,12 +19,12 @@
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
module GF.Speech.SRG (SRG(..), SRGRule(..), SRGAlt(..),
|
||||
SRGCat, SRGNT,
|
||||
SRGCat, SRGNT, CFTerm,
|
||||
makeSimpleSRG, makeSRG
|
||||
, lookupFM_, prtS
|
||||
, topDownFilter, cfgCatToGFCat, srgTopCats
|
||||
, EBnfSRGAlt(..), EBnfSRGItem
|
||||
, ebnfSRGAlts
|
||||
--, EBnfSRGAlt(..), EBnfSRGItem
|
||||
--, ebnfSRGAlts
|
||||
) where
|
||||
|
||||
import GF.Data.Operations
|
||||
@@ -64,13 +64,13 @@ data SRGRule = SRGRule SRGCat String [SRGAlt] -- ^ SRG category name, original c
|
||||
deriving (Eq,Show)
|
||||
|
||||
-- | maybe a probability, a rule name and a list of symbols
|
||||
data SRGAlt = SRGAlt (Maybe Double) Name [Symbol SRGNT Token]
|
||||
data SRGAlt = SRGAlt (Maybe Double) CFTerm [Symbol SRGNT Token]
|
||||
deriving (Eq,Show)
|
||||
|
||||
type SRGCat = String
|
||||
|
||||
-- | An SRG non-terminal. Category name and slots which it fills in.
|
||||
type SRGNT = (SRGCat, [Int])
|
||||
-- | An SRG non-terminal. Category name and its number in the profile.
|
||||
type SRGNT = (SRGCat, Int)
|
||||
|
||||
-- | SRG category name and original name
|
||||
type CatName = (SRGCat,String)
|
||||
@@ -129,17 +129,13 @@ cfgRulesToSRGRule names probs rs@(r:_) = SRGRule cat origCat rhs
|
||||
origCat = lhsCat r
|
||||
cat = lookupFM_ names origCat
|
||||
rhs = nub $ map ruleToAlt rs
|
||||
ruleToAlt r@(CFRule c ss n@(Name _ prs))
|
||||
ruleToAlt r@(CFRule c ss n)
|
||||
= SRGAlt (ruleProb probs r) n (mkSRGSymbols 0 ss)
|
||||
where
|
||||
mkSRGSymbols _ [] = []
|
||||
mkSRGSymbols i (Cat c:ss) = Cat (c',slots) : mkSRGSymbols (i+1) ss
|
||||
where c' = lookupFM_ names c
|
||||
slots = [x | x <- [0..length prs-1], inProfile i (prs!!x)]
|
||||
mkSRGSymbols i (Cat c:ss) = Cat (renameCat c,0) : mkSRGSymbols (i+1) ss
|
||||
mkSRGSymbols i (Tok t:ss) = Tok t : mkSRGSymbols i ss
|
||||
inProfile :: Int -> Profile a -> Bool
|
||||
inProfile x (Unify xs) = x `elem` xs
|
||||
inProfile _ (Constant _) = False
|
||||
renameCat = lookupFM_ names
|
||||
|
||||
ruleProb :: Maybe Probs -> CFRule_ -> Maybe Double
|
||||
ruleProb mp r = mp >>= \probs -> lookupProb probs (ruleFun r)
|
||||
@@ -182,6 +178,7 @@ srgTopCats srg = buildMultiMap [(oc, cat) | SRGRule cat origCat _ <- rules srg,
|
||||
-- * Size-optimized EBNF SRGs
|
||||
--
|
||||
|
||||
{-
|
||||
data EBnfSRGAlt = EBnfSRGAlt (Maybe Double) Name EBnfSRGItem
|
||||
deriving (Eq,Show)
|
||||
|
||||
@@ -204,6 +201,7 @@ addString xs fa = addFinalState (last sts0) $ newTransitions ts fa'
|
||||
sts0 = startState fa : sts1
|
||||
sts1 = map fst ss
|
||||
ts = zip3 sts0 sts1 xs
|
||||
-}
|
||||
|
||||
--
|
||||
-- * Utilities for building and printing SRGs
|
||||
|
||||
@@ -27,7 +27,7 @@ import GF.Conversion.Types
|
||||
import GF.Data.Utilities
|
||||
import GF.Formalism.CFG
|
||||
import GF.Formalism.Utilities (Symbol(..), mapSymbol, filterCats, symbol,
|
||||
NameProfile(..), name2fun)
|
||||
NameProfile(..), Profile(..), name2fun, forestName)
|
||||
import GF.Infra.Ident
|
||||
import GF.Infra.Option
|
||||
import GF.Infra.Print
|
||||
@@ -44,19 +44,34 @@ import Data.Set (Set)
|
||||
import qualified Data.Set as Set
|
||||
|
||||
|
||||
-- | not very nice to replace the structured CFCat type with a simple string
|
||||
type CFRule_ = CFRule Cat_ Name Token
|
||||
-- not very nice to replace the structured CFCat type with a simple string
|
||||
type CFRule_ = CFRule Cat_ CFTerm Token
|
||||
|
||||
data CFTerm
|
||||
= CFObj Fun [CFTerm]
|
||||
| CFAbs Int CFTerm
|
||||
| CFApp CFTerm CFTerm
|
||||
| CFRes Int
|
||||
| CFVar Int
|
||||
| CFConst String
|
||||
deriving (Eq,Show)
|
||||
|
||||
type Cat_ = String
|
||||
type CFSymbol_ = Symbol Cat_ Token
|
||||
|
||||
type CFRules = [(Cat_,[CFRule_])]
|
||||
|
||||
|
||||
cfgToCFRules :: CGrammar -> CFRules
|
||||
cfgToCFRules cfg = groupProds [CFRule (catToString c) (map symb r) n | CFRule c r n <- cfg]
|
||||
cfgToCFRules cfg =
|
||||
groupProds [CFRule (catToString c) (map symb r) (nameToTerm n)
|
||||
| CFRule c r n <- cfg]
|
||||
where symb = mapSymbol catToString id
|
||||
-- symb (Cat c) = Cat (catToString c)
|
||||
-- symb (Tok t) = Tok t
|
||||
catToString = prt
|
||||
nameToTerm (Name f prs) = CFObj f (map profileToTerm prs)
|
||||
profileToTerm (Unify []) = CFConst "?"
|
||||
profileToTerm (Unify xs) = CFRes (last xs) -- FIXME: unify
|
||||
profileToTerm (Constant f) = CFConst (maybe "?" prIdent (forestName f))
|
||||
|
||||
-- | Remove productions which use categories which have no productions
|
||||
removeEmptyCats :: CFRules -> CFRules
|
||||
@@ -80,35 +95,44 @@ removeIdenticalRules g = [(c,sortNubBy cmpRules rs) | (c,rs) <- g]
|
||||
|
||||
-- * Removing left recursion
|
||||
|
||||
{-
|
||||
|
||||
-- The LC_LR algorithm from
|
||||
-- http://research.microsoft.com/users/bobmoore/naacl2k-proc-rev.pdf
|
||||
-- Not used since I haven't figured out how to make proper profiles. /Bjorn
|
||||
removeLeftRecursion :: Cat_ -> CFRules -> CFRules
|
||||
removeLeftRecursion start gr
|
||||
= groupProds $ concat [scheme1, scheme2, scheme3, scheme4]
|
||||
where
|
||||
scheme1 = [CFRule a [x,Cat a_x] (Name (IC "phony1") []) |
|
||||
scheme1 = [CFRule a [x,Cat a_x] n' |
|
||||
a <- retainedLeftRecursive,
|
||||
x <- properLeftCornersOf a,
|
||||
not (isLeftRecursive x),
|
||||
let a_x = mkCat (Cat a) x]
|
||||
scheme2 = [CFRule a_x (beta++[Cat a_b]) (Name (IC "phony2") []) |
|
||||
let a_x = mkCat (Cat a) x,
|
||||
let n' = symbol (\_ -> CFApp (CFRes 1) (CFRes 0))
|
||||
(\_ -> CFRes 0) x]
|
||||
scheme2 = [CFRule a_x (beta++[Cat a_b]) n' |
|
||||
a <- retainedLeftRecursive,
|
||||
b@(Cat b') <- properLeftCornersOf a,
|
||||
isLeftRecursive b,
|
||||
CFRule _ (x:beta) n <- catRules gr b',
|
||||
let a_x = mkCat (Cat a) x,
|
||||
let a_b = mkCat (Cat a) b]
|
||||
scheme3 = [CFRule a_x beta n | -- FIXME: remove 0 from all profile elements
|
||||
let a_b = mkCat (Cat a) b,
|
||||
let i = length $ filterCats beta,
|
||||
let n' = symbol (\_ -> CFAbs 1 (CFApp (CFRes i) (shiftTerm n)))
|
||||
(\_ -> CFApp (CFRes i) n) x]
|
||||
scheme3 = [CFRule a_x beta n' |
|
||||
a <- retainedLeftRecursive,
|
||||
x <- properLeftCornersOf a,
|
||||
CFRule _ (x':beta) n <- catRules gr a,
|
||||
x == x',
|
||||
let a_x = mkCat (Cat a) x]
|
||||
let a_x = mkCat (Cat a) x,
|
||||
let n' = symbol (\_ -> CFAbs 1 (shiftTerm n))
|
||||
(\_ -> n) x]
|
||||
scheme4 = catSetRules gr $ Set.fromList $ filter (not . isLeftRecursive . Cat) cats
|
||||
|
||||
shiftTerm :: CFTerm -> CFTerm
|
||||
shiftTerm (CFObj f ts) = CFObj f (map shiftTerm ts)
|
||||
shiftTerm (CFRes 0) = CFVar 1
|
||||
shiftTerm t = t
|
||||
|
||||
cats = allCats gr
|
||||
rules = ungroupProds gr
|
||||
|
||||
@@ -121,7 +145,6 @@ removeLeftRecursion start gr
|
||||
leftRecursive = reflexiveElements properLeftCorner
|
||||
isLeftRecursive = (`Set.member` leftRecursive)
|
||||
|
||||
-- FIXME: include start cat
|
||||
retained = start `Set.insert`
|
||||
Set.fromList [a | (c,rs) <- gr, not (isLeftRecursive (Cat c)),
|
||||
r <- rs, Cat a <- ruleRhs r]
|
||||
@@ -131,9 +154,9 @@ removeLeftRecursion start gr
|
||||
|
||||
mkCat :: CFSymbol_ -> CFSymbol_ -> Cat_
|
||||
mkCat x y = showSymbol x ++ "-" ++ showSymbol y
|
||||
where showSymbol = symbol id ("$"++) -- FIXME !!!!!
|
||||
where showSymbol = symbol id show
|
||||
|
||||
-}
|
||||
{-
|
||||
|
||||
-- Paull's algorithm, see
|
||||
-- http://research.microsoft.com/users/bobmoore/naacl2k-proc-rev.pdf
|
||||
@@ -176,12 +199,13 @@ isDirectLeftRecursive :: CFRule_ -> Bool
|
||||
isDirectLeftRecursive (CFRule c (Cat c':_) _) = c == c'
|
||||
isDirectLeftRecursive _ = False
|
||||
|
||||
-}
|
||||
|
||||
-- * Removing cycles
|
||||
|
||||
removeCycles :: CFRules -> CFRules
|
||||
removeCycles = groupProds . removeCycles_ . ungroupProds
|
||||
where removeCycles_ rs = [r | r@(CFRule c rhs n) <- rs, rhs /= [Cat c]]
|
||||
where removeCycles_ rs = [r | r@(CFRule c rhs _) <- rs, rhs /= [Cat c]]
|
||||
|
||||
|
||||
-- | Get the sets of mutually recursive non-terminals for a grammar.
|
||||
@@ -221,7 +245,11 @@ ruleRhs :: CFRule c n t -> [Symbol c t]
|
||||
ruleRhs (CFRule _ ss _) = ss
|
||||
|
||||
ruleFun :: CFRule_ -> Fun
|
||||
ruleFun (CFRule _ _ n) = name2fun n
|
||||
ruleFun (CFRule _ _ t) = f t
|
||||
where f (CFObj n _) = n
|
||||
f (CFApp _ x) = f x
|
||||
f (CFAbs _ x) = f x
|
||||
f _ = IC ""
|
||||
|
||||
-- | Checks if a symbol is a non-terminal of one of the given categories.
|
||||
catElem :: Symbol Cat_ t -> Set Cat_ -> Bool
|
||||
@@ -232,7 +260,5 @@ catElem s cs = symbol (`Set.member` cs) (const False) s
|
||||
anyUsedBy :: Eq c => [c] -> CFRule c n t -> Bool
|
||||
anyUsedBy cs (CFRule _ ss _) = any (`elem` cs) (filterCats ss)
|
||||
|
||||
mkName :: String -> Name
|
||||
mkName n = Name (IC n) []
|
||||
|
||||
|
||||
mkCFTerm :: String -> CFTerm
|
||||
mkCFTerm n = CFObj (IC n) []
|
||||
Reference in New Issue
Block a user