import Prelude as P;import Char as C;import List;import System as S;
main = do
 (.--.)<-(--.|.--.+);(.-)<-(--.|.-+)
 case (.-) of ["+",(.-)]->(-|---|--+) (.-);["-",(.-)]->(..-.|.-.|--+) (.-);_->(.|.-.)("Usage: "++(.--.)++" (+/-) F.hs")
 where
 (-|---|--+) (.-)=do (..-.)<-(.-.|..-.+) (.-);(.--.|...+)(((-.-.|--+) (.--).(--.).(-..-))(..-.))
 (..-.|.-.|--+) (.-)=do (..-.)<-(.-.|..-.+) (.-);(.--.|...+)(((-.-.|--+) (.--|=).(--.|=).(-..-))(..-.))

-- | (--| ): (-.-.|---|-.|...-|.|.-.|-) (-.-.|....|.-|.-.) -> (--|---|.-.|...|.)
_--| 'a'=".-";_--| 'b'="-...";_--| 'c'="-.-.";_--| 'd'= "-..";_--| 'e'=".";
_--| 'f'="..-.";_--| 'g'="--.";_--| 'h'="....";_--| 'i'="..";_--| 'j'=".---";
_--| 'k'="-.-";_--| 'l'=".-..";_--| 'm'="--";_--| 'n'="-.";_--| 'o'="---";
_--| 'p'=".--.";_--| 'q'="--.-";_--| 'r'=".-.";_--| 's'="...";_--| 't'="-";
_--| 'u'="..-";_--| 'v'="...-";_--| 'w'=".--";_--| 'x'="-..-";_--| 'y'="-.--";
_--| 'z'="--..";_--| '0'="-----";_--| '1'=".----";_--| '2'="..---";
_--| '3'="...--";_--| '4'="....-";_--| '5'=".....";_--| '6'="-....";
_--| '7'="--...";_--| '8'="---..";_--| '9'="----.";_--| '_'="!";_--| '\''="=";
_--| (-.-.)
 |'A'<=(-.-.)&&(-.-.)<='Z'=(()--| (-|.-..+) (-.-.))++"+"
 |(-..|.|..-.)=[(-.-.)]

-- | (--|=): (..|-.|...-) of (--| )
(--|=) (...)=(..-.)[(-.-.)|(-.-.)<-['a'..'z']++['0'..'9']++['A'..'Z']++['_','\''],()--| (-.-.)==(...)]
 where (..-.)[]=(....|-..) (...);(..-.) (-.-.|...)=(....|-..) (-.-.|...)

-- | (.--): (-.-.|---|-.|...-|.|.-.|-) (.--|---|.-.|-..)
(.--) (...)
 |(...).|.-..["e","i","m","o","t"]=(.--)((...)++" ") -- (...|---|--|.) (..-|-.|-|..|-..|-.--) (.|-..-|-.-.|.|.--.|-|..|---|-.|...):
 -- .=(-.-.|---|--|.--.|---|...|..|-|..|---|-.), ..=(-.|..-|--|.|.-.|..|-.-.) (.-.|.-|-.|--.|.), --/---=(.|-.|-..)-of-(.-..|..|-.|.) (-.-.|---|--|--|.|-.|-), -=(...|..-|-...|-|.-.|.-|-.-.|-|..|---|-.)
 |(...).|.-..(-.-|.|-.--|...)=(...)
 |(..|-..) (...)=(('(':).(++")").(-.-.|-.-.).(..|.--.) "|".(--|.--.)((--| )()))(...)
 |(..|-.|..-.|-..-) (...)=((-|.-..).(..|-).(.--).(-|.-..).(..|-))(...)
 |(-..|.|..-.)=(...)
 where
 (..|-..)((-..-):_)=(..|.-..+) (-..-)||(-..-)=='_'
 (..|-.|..-.|-..-)((-..-):_)=(-..-)=='`'

-- | (.--|=): do (..|-.|...-) of (.--)
(.--|=) (...)
 |(...)=="|"="|"
 |(..|-..) (...)=((--|.--.) (--|=).(-.-.|....|.-.|...).(-|.-..).(..|-))(...)
 |(---|-.|.) (...)='`':((--|=).(..|-))(...):"`"
 |(..|-.|..-.|-..-) (...)='`':((--|.--.) (--|=).(-.-.|....|.-.|...))(...)++"`"
 |(-..|.|..-.)=(...)
 where
 (..|-..)('(':(....):(-| ))=(.--.|.-.|.) (....)&&(.-..|.-) (-| )==')'&&(.-|.-..)(??)((..|-) (-| ))
 (..|-..) _=False
 (.--.|.-.|.) (-.-.)=(-.-.).|.-..".-"
 (..|-.|..-.|-..-) (...)=(.--.|.-.|.) ((....|-..) (...))&&(.-|.-..)(??)((-|.-..) (...))&&(.-|-.)(=='|')(...)
 (---|-.|.) (...)=(.-|.-..) (.--.|.-.|.) ((..|-) (...))&&(.-..|.-) (...)=='|'
 (-.-.|....|.-.|...) (...)=case (-..|.--+)(=='|')(...) of []->[];(...)->let ((.--),(...|...))=(-...|.-.)(=='|')(...) in (.--):(-.-.|....|.-.|...) (...|...)

-- | (.--.|.-.|.|-..) (---|-.) (-.-.|....|.-|.-.|...)
(??)(-.-.)=(-.-.).|.-..".-+/=!|"

-- | (.-..|.|-..-) (...|.-.|-.-.) -> (-|---|-.-) (...|-|.-.|.|.-|--)
(-..-)[]=[]
(-..-)((-.-.):(...))|(..|...+) (-.-.)=((-.-.):(...|...)):(-..-) (.-.|--) where ((...|...),(.-.|--))=(...|.--.) (..|...+) (...)
(-..-) (...)=(-|---|-.-):(-..-) (.-.|--) where ((-|---|-.-),(.-.|--))=(....|-..)((.--.|.-..|.|-..-) (...))

-- | (--.): (--.|.-..|..-|.) (...|.|--.-) (-|---|-.-|...) -> (...|..|-.|--.|.-..|.) (-|---|-.-)
(--.)((--.-):".":(-.):(.-.|--))|(..|..-+)((....|-..) (--.-))=(--.)(((--.-)++"."++(-.)):(.-.|--))
(--.)("`":(.-.|--))=case (--.) (.-.|--) of ((--.-|-.):"`":(.-.|--))->("`"++(--.-|-.)++"`"):(--.) (.-.|--);_->("`":(.-.|--))
(--.)((...):(...|...))=(...):(--.) (...|...)
(--.)[]=[]

-- | (--.|=): (.-..|..|-.-|.) (--.) in (.-.|.|...-)
(--.|=)("(":(-.):")":(.-.|--))|(.-|.-..)(??)(-.)=("("++(-.)++")"):(--.|=) (.-.|--)
(--.|=)("(":(-.):" ":")":(.-.|--))|(.-|.-..)(??)(-.)=("("++(-.)++")"):(--.|=) (.-.|--)
(--.|=)("|":(.-.|--))="|":(--.|=) (.-.|--)
(--.|=)((-.):(...|...):(.-.|--))|(.-|.-..)(.|.-..".-")((..|-) (-.))&&(.-..|.-) (-.)=='|'&&(.-|.-..) (..|...+) (...|...)=(-.):(--.|=) (.-.|--)
(--.|=)((-.):(.-.|--))=(-.):(--.|=) (.-.|--)
(--.|=)[]=[]

-- | (....|.-|...|-.-|.|.-..|.-..) (-.-|.|-.--|.--|---|.-.|-..|...)
(-.-|.|-.--|...)=
 ["case","class","data","default","deriving","do","else"
 ,"if","import","in","infix","infixl","infixr","instance","let","module"
 ,"newtype","of","then","type","where","_","main","foreign","ccall","as"]

-- | (.-|-...|-...|.-.|.|...-) (.-..|..|-...) (..-.|-.|...)
(-.-.|-.-.)=P.concat;(.|.-..) (-..-)=P.elem (-..-);(--|.--.)=P.map;(-.-.|--+)=P.concatMap;
(...|.--.)=P.span;(-...|.-.)=P.break;(..|.--.)=List.intersperse;(-..|.--+)=P.dropWhile;
(....|-..)=P.head;(-|.-..)=P.tail;(..|-)=P.init;(.-..|.-)=P.last;
(-|.-..+)=C.toLower;(..|.-..+)=C.isLower;(..|...+)=C.isSpace;(..|..-+)=C.isUpper;
(.-.|..-.+)=P.readFile;(.--.|...+)=P.putStr;(.|.-.)=P.error;
(--.|.-+)=S.getArgs;(--.|.--.+)=S.getProgName;
(.-|.-..)=P.all;(.-|-.)=P.any;(-..|.|..-.)=P.otherwise;(.--.|.-..|.|-..-)=P.lex;

