Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,263
    • Issues 4,263
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 416
    • Merge Requests 416
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Wiki
    • Ghci debugger
  • breakpoint jump

Last edited by Takenobu Tani Apr 14, 2019
Page history New page

breakpoint jump

(thanks to Bernie Pope for letting me take advantage of his efforts with notation and abstract syntax)

An abstract syntax

For the purpose of exploring the rules we need an abstract syntax. Below is one for a simple core functional language:

   Decls(D)        -->   x :: T   |   x = E   |   data f a1 .. an = K1 .. Km

   Constructors(K) -->   k T1 .. Tn

   Types(T)        -->   f   |   a   |   T1 T2

   Expressions(E)  -->   x   |   k   |   E1 E2   |   let D1 .. Dn in E   |   case E of A1 .. An   |   \y1 .. yn -> E

   Alts(A)         -->   p -> E

   Pats(P)         -->   x   |   k P1 .. Pn

Notation

Double square brackets denote the transformation function, which has two arguments: the expression itself and a list of bindings in scope. For instance:

   [[E ]]_b  ==> [[E' ]]_b'

means transform expression E with b as the list of bindings in scope into E' with the new list l'

Double brackets denote the auxiliary binding capture function, which takes an expression and returns a list of the variables bound in it:

   {{ E }}    ==> x1 .. xn  |  []

breakpointJump desugaring

The main role of the desugaring, as shown by the rules, is injecting the explicit list of local bindings.

In the rules below <breakpoint> and <breakpointJump> are placeholders for the several breakpoint flavors. Each flavor of breakpoint has a corresponding jump function:

 breakpoint      -  breakpointJump
 breakpointCond  -  breakpointJumpCond
 breakpointAuto  -  breakpointJumpAuto

The <ptr b> placeholder denotes a pointer to the compiler datastructures for b, which in GHC are values of type compiler/basictypes/Id.hs.

The <srcloc x> placeholder denotes the source code location information for the expression x.

Declarations:

   [[x :: T ]]_b             ==>   x :: T

   [[x = E ]]_b              ==>   x = [[E ]]_b

   [[data f a1 .. an = K1 .. Km ]]_b 
                              ==>   data f a1 .. an = K1 .. Km

   {{ x = E }}                ==>   x 

Expressions:

   [[<breakpoint> x ]]_b     ==>   <breakpointJump> <ptr b> b <srcloc x> [[x]]_b

   [[x ]]_b                  ==>   x
   
   [[k ]]_b                  ==>   k

   [[E1 E2 ]]_b              ==>   [[E1 ]]_b [[E2 ]]_b

   [[let D1 .. Dn in E ]]_b  ==>   let [[D1 ]]_b .. [[Dn ]]_b in  [[E ]]_b'
                                    where b' = {{ D1 }} ++ .. ++ {{ Dn }}

   [[case E of A1 .. An ]]_b ==>   case [[E ]]_b of [[A1 ]]_b .. [[An ]]_b

   [[\y1 .. yn -> E ]]_b     ==>   \y1 .. yn -> [[E ]]_(y1 .. yn ++ b)


   {{ E }}                    ==>   [] 

Alternatives:

   [[p -> E ]]_b             ==>   p -> [[E ]]_({{p}} ++ b)

 
   {{ A }}                    ==>   []

Pats:

   {{ x }}                    ==>   x
   
   {{ k P1 .. Pn }}           ==>   {{ P1 }} ++  ...  ++ {{ Pn }}
Clone repository

GHC Home
GHC User's Guide

Joining In

Newcomers info
Mailing Lists & IRC
The GHC Team

Documentation

GHC Status Info
Working conventions
Building Guide
Debugging
Commentary

Wiki

Title Index
Recent Changes