language-haskell icon indicating copy to clipboard operation
language-haskell copied to clipboard

Feature request: syntax highlighting for .dump-stg and .dump-simpl files

Open varosi opened this issue 8 years ago • 2 comments

I'll be great to have such highlighting and it'll help debugging.

I mean files that are generated with -ddump-simpl and -ddump-stg GHC flags.

varosi avatar Nov 02 '16 17:11 varosi

If there is a formal syntax definition somewhere out there, I might take a look. Otherwise, not very likely in the near future.

lierdakil avatar Nov 15 '16 14:11 lierdakil

It's not well documented, but -ddump-stg generate some basic syntax, that could be used. Like: `

==================== STG syntax: ==================== 2016-11-15 21:26:07.5810105 UTC

add :: forall a. Num a => a -> a -> a = \r srt:SRT:[] [$dNum a1 b] + $dNum a1 b;

main2 :: [Char] = \u srt:SRT:[] [] unpackCString# "hello world"#;

main1 :: State# RealWorld -> (# State# RealWorld, () #) = \r srt:SRT:[rzi :-> hPutStr2, rAy :-> stdout, r1Dw :-> main2] [eta] hPutStr2 stdout main2 True eta;

main :: IO () = \r srt:SRT:[r1Dv :-> main1] [eta] main1 eta;

main3 :: State# RealWorld -> (# State# RealWorld, () #) = \r srt:SRT:[rUd :-> runMainIO1, r1Dv :-> main1] [eta] runMainIO1 main1 eta;

main :: IO () = \r srt:SRT:[r1Dx :-> main3] [eta] main3 eta;

$trModule2 :: TrName = NO_CCS TrNameS! ["main"#];

$trModule1 :: TrName = NO_CCS TrNameS! ["Main"#];

$trModule :: Module = NO_CCS Module! [$trModule2 $trModule1]; `

Not everything could be colored. May be types, names, type constructors and unboxed types (with sharp symbol) will be great start!

varosi avatar Nov 15 '16 21:11 varosi