"{ Package: 'jv:tea/compiler' }"
"{ NameSpace: Smalltalk }"
TestCase subclass:#TCompilerExamples
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Languages-Tea-Compiler-Examples'
!
!TCompilerExamples class methodsFor:'asserting'!
isTestSelector:aSelector
^ (super isTestSelector:aSelector) or:[ aSelector startsWith: 'example' ]
"Created: / 14-09-2015 / 11:56:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TCompilerExamples methodsFor:'tests'!
example_if
| environment unit compiler|
environment := TEnvironment new.
unit := TSourceReader read:'
nil subclass: #If
category: ''t-Examples''
!!
!!If class methodsFor:''examples''!!
if <^ tSIntegerW>
true ifTrue:[ ^ 1 ] ifFalse:[ ^ 0 ]
'.
compiler := TCompiler new.
compiler compile: unit in: environment.
self halt.
"
compiler context module
"
"Created: / 14-09-2015 / 12:14:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 15-09-2015 / 12:22:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
example_three_plus_four
| environment unit compiler|
environment := TEnvironment new.
unit := TSourceReader read:'
nil subclass: #ThreePlusFour
category: ''t-Examples''
!!
!!ThreePlusFour class methodsFor:''examples''!!
threePlusFour <^ tSIntegerW>
^ 3 + 4
!! !!
'.
compiler := TCompiler new.
compiler compile: unit in: environment.
self halt.
"
compiler context module
"
"Created: / 14-09-2015 / 11:56:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 14-09-2015 / 15:15:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !