Some documentation.
[hs-java.git] / JVM / Assembler.hs
index b29eae847cdeb293dacb72c96b2da62db883e248..7ac59c64a0915734a64e55f261d51ac32e9f95bf 100644 (file)
@@ -10,6 +10,7 @@ module JVM.Assembler
    Code (..),
    IMM (..),
    CMP (..),
+   atype2byte,
    encodeInstructions,
    encodeMethod,
    decodeMethod
@@ -53,7 +54,7 @@ data Code = Code {
     codeExceptionsN :: Word16,
     codeExceptions :: [CodeException],
     codeAttrsN :: Word16,
-    codeAttributes :: Attributes Pointers }
+    codeAttributes :: Attributes File }
   deriving (Eq, Show)
 
 -- | Exception descriptor
@@ -115,7 +116,7 @@ readInstructions = do
           next <- readInstructions
           return (x: next)
 
--- | JVM instruction set
+-- | JVM instruction set. For comments, see JVM specification.
 data Instruction =
     NOP            -- ^ 0
   | ACONST_NULL    -- ^ 1
@@ -707,6 +708,7 @@ instance BinaryState Integer Instruction where
         | inRange (159, 164) c -> IF_ICMP (toEnum $ fromIntegral $ c-159) <$> get
         | otherwise -> fail $ "Unknown instruction byte code: " ++ show c
 
+-- | Encode list of instructions
 encodeInstructions :: [Instruction] -> B.ByteString
 encodeInstructions code =
   let p list = forM_ list put