compiler/PPCPassVisitor.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 19 Mar 2016 00:12:47 +0100
changeset 556 51c6afba5c91
parent 534 a949c4fe44df
permissions -rw-r--r--
CI: Use VM provided by Pharo team on both Linux and Windows. Hand-crafter Pharo VM is no longer needed as the Linux slave in SWING build farm has been upgraded so it has compatible GLIBC. This makes CI scripts simpler and more usable for other people.

"{ Package: 'stx:goodies/petitparser/compiler' }"

"{ NameSpace: Smalltalk }"

PPCNodeVisitor subclass:#PPCPassVisitor
	instanceVariableNames:'context'
	classVariableNames:''
	poolDictionaries:''
	category:'PetitCompiler-Visitors'
!


!PPCPassVisitor class methodsFor:'converting'!

asPPCPass
    ^ self new

    "Created: / 29-08-2015 / 07:12:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!PPCPassVisitor methodsFor:'accessing'!

context
    ^ context
!

context: aPPCCompilationContext
    context := aPPCCompilationContext.

    "Created: / 26-08-2015 / 22:05:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!PPCPassVisitor methodsFor:'converting'!

asPPCPass
    ^ self

    "Created: / 29-08-2015 / 07:13:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!PPCPassVisitor methodsFor:'running'!

run: ir
    "Actually run the pass on given IR (tree of PPCNode) and return
     (possibly transformed or completely new) another IR."

    context isNil ifTrue:[ 
        PPCCompilationError new signal: 'oops, no context set, use #context: before running a pass!!'.
    ].
    ^ self visit: ir.

    "Created: / 26-08-2015 / 22:30:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

run: ir in: ctx
    "Actually run the pass on given IR (tree of PPCNode) in given
     compilation context and return (possibly transformed or completely 
     new) another IR."

    context := ctx.
    ^ self run: ir.

    "Created: / 26-08-2015 / 22:33:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!PPCPassVisitor class methodsFor:'documentation'!

version
    ^ 'Path: stx/goodies/petitparser/compiler/PPCPass.st, Version: 1.0, User: jv, Time: 2015-08-29T07:53:24.558+01'
!

version_HG
    ^ 'Path: stx/goodies/petitparser/compiler/PPCPass.st, Version: 1.0, User: jv, Time: 2015-08-29T07:53:24.558+01'
! !