[Yhc] YHC Core Semantics

Ricky Barefield aca03rdb at sheffield.ac.uk
Mon Mar 12 07:05:43 EDT 2007


Hi,
 
I'm still working with YHC Core to try to eventually to convert to Java.
 
I'm having a little bit of trouble trying to fully understand the
semantics of the YHC Core language.
 
I've translated
 
increase x = x+1
 
into Core for a simple example.  The Core produced is
 
 
Core {
  coreName :: Increase
  coreImports :: [Data.Ratio,Prelude]
  coreDatas ::           [
          []
  coreFuncs :: 
          [
          CoreFunc {
                coreFuncName :: Increase.increase
                coreFuncArgs :: [v207,v208]
                coreFuncBody :: CorePos 4:1-4:16 (CoreApp 
                                                        (
                                                        CoreApp 
                                                              (
                                                              CoreFun
Prelude.+
                                                              ) 
                                                              [CoreVar
v207]
                                                        ) 
                                                        [CoreVar
v208,CoreApp 
                                                        (
                                                        CoreApp 
                                                              (
                                                              CoreFun
Prelude.fromInteger
                                                              ) 
                                                              [CoreVar
v207]
                                                        ) 
                                                        [CoreInteger
1]])
                   }
          ]
}
 
The bit I'm having trouble with is the CoreApp's they have an expression
and a list of expressions, does this mean that the first expression
should be applied to each element of the list?
 
In particular from above
 
(CoreApp
 
      (CoreApp (CoreFun Prelude.+) [CoreVar v207])
      
      
      [
        CoreVar v208,
        CoreApp 
                (CoreApp (CoreFun Prelude.fromInteger) [CoreVar v207])
              [CoreInteger 1]
      ]
)
 
so is v208 the 1 from the original Haskell?  If so why is it then
explicitly mentioned (CoreIntger 1)?  This function originally took 1
argument it now takes 2.
 
As you can tell I'm a little confused!
 
If anyone can enlighten me It'd be appreciated.
 
Many Thanks,
 
Ricky Barefield
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/yhc/attachments/20070312/c363a0d5/attachment-0001.htm


More information about the Yhc mailing list