Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
codeZeilen committed Jan 12, 2023
2 parents cf95f12 + 00fe364 commit bc5be74
Show file tree
Hide file tree
Showing 417 changed files with 1,979 additions and 486 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Babylonian Programming / Smalltalk [![Build Status Main](https://img.shields.io/github/workflow/status/hpi-swa-lab/babylonian-programming-smalltalk/testAndBuild/main?logo=github&label=main)](https://github.com/hpi-swa-lab/babylonian-programming-smalltalk/actions/workflows/main.yml) [![Build Status Develop](https://img.shields.io/github/workflow/status/hpi-swa-lab/babylonian-programming-smalltalk/testAndBuild/develop?logo=github&label=develop)](https://github.com/hpi-swa-lab/babylonian-programming-smalltalk/actions/workflows/main.yml)
# Babylonian Programming / Smalltalk
[![Build Status Main](https://img.shields.io/github/actions/workflow/status/hpi-swa-lab/babylonian-programming-smalltalk/main.yml?logo=github&label=main&branch=main)](https://github.com/hpi-swa-lab/babylonian-programming-smalltalk/actions/workflows/main.yml)
[![Build Status Develop](https://img.shields.io/github/actions/workflow/status/hpi-swa-lab/babylonian-programming-smalltalk/main.yml?logo=github&label=develop&branch=develop)](https://github.com/hpi-swa-lab/babylonian-programming-smalltalk/actions/workflows/main.yml)

A Smalltalk implementation of the Babylonian Programming System.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
private
keywords

^ #(bpProbe bpReplace bpAssert exampleNamed)
^ #(bpProbe bpReplace bpAssert bpProfilingProbe bpTypeProbe exampleNamed)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
private
parse: code

^ BPSmalltalkGrammar
^ PEGParserBPSmalltalk new
match: code
startingFrom: #MethodDeclaration
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"backgroundCompileInstrumentedVersionOf:basedOn:" : "pre 10/12/2020 15:36",
"compileCue:noPattern:ifFail:" : "pre 7/20/2022 16:41",
"compileInstrumentedVersionOf:" : "jb 9/9/2021 17:31",
"keywords" : "pre 7/26/2019 14:00",
"keywords" : "pre 11/30/2022 09:33",
"methodSourceRequiresBPLayers:" : "pre 11/11/2019 15:49",
"parse:" : "pre 1/11/2021 15:51",
"parse:" : "pre 5/3/2021 15:01",
"rewriteToSource:" : "pre 8/17/2020 08:54",
"rewriter" : "jb 12/7/2020 18:03" } }
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rules
Pragma: aNode with: literal with: values with: anotherLiteral

| exampleName |
(BPExample bpExamplePragmaPrefixes anySatisfy: [:prefix | values children first interval contents beginsWith: prefix]) ifTrue: [
(BPAbstractExample bpExamplePragmaPrefixes anySatisfy: [:prefix | values children first interval contents beginsWith: prefix]) ifTrue: [
exampleName := self value: values children first children first.
annotations add: (BPExampleAnnotation new
exampleName: exampleName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"KeywordPragma:with:with:" : "pre 7/23/2019 12:10",
"MethodDeclaration:with:and:and:" : "pre 7/23/2022 20:12",
"MethodHeader:with:" : "pre 7/23/2022 16:19",
"Pragma:with:with:with:" : "pre 9/6/2022 11:12",
"Pragma:with:with:with:" : "pre 1/11/2023 14:38",
"Pragmas:pragmas:" : "jb 12/7/2020 18:01",
"defaultExpression:" : "jb 12/7/2020 18:01",
"initialize" : "pre 3/24/2020 09:39",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
as yet unclassified
Reference: aNode with: identifier

^ (argumentNames includes: identifier interval contents asSymbol)
ifTrue: [self value: identifier]
ifFalse: ['(self bpResolveReferenceDynamically: #' , identifier interval contents , ' in: thisContext)']
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
blockArgument: aNode with: some and: more and: moree and: evenMore
argumentNames add: aNode interval contents copyWithoutFirst asSymbol.
^ aNode interval contents
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ initialize-release
initialize

super initialize.
dictionary := IdentityDictionary new.
argumentNames := Set new.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"class" : {
},
"instance" : {
"Reference:with:" : "pre 1/10/2023 17:50",
"blockArgument:with:and:and:and:" : "pre 1/10/2023 17:51",
"initialize" : "pre 1/10/2023 17:37" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Babylonian-Compiler",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"argumentNames" ],
"name" : "BPReferenceRewriter",
"pools" : [
],
"super" : "OhmSmalltalkSourceRewriter",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rewrite rules
bpProfilingProbe: annotation with: originalExpressionSourceNode

^ annotation instrumentationCallFor: (self value: originalExpressionSourceNode)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rewrite rules
bpTypeProbe: annotation with: originalExpressionSourceNode

^ annotation instrumentationCallFor: (self value: originalExpressionSourceNode)
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
"MethodHeader:with:" : "pre 9/25/2020 11:14",
"bpAssert:with:" : "pre 9/25/2020 11:20",
"bpProbe:with:" : "pre 9/25/2020 11:20",
"bpProfilingProbe:with:" : "pre 11/29/2022 16:45",
"bpReplace:with:" : "pre 9/25/2020 11:20",
"bpSlider:with:" : "pre 9/1/2022 20:51",
"bpTemporaryProbe:with:" : "pre 9/2/2022 15:03",
"bpTypeProbe:with:" : "pre 11/30/2022 09:34",
"expressionAnnotationStart:with:and:and:and:and:and:and:" : "pre 8/6/2021 18:49",
"initialize" : "pre 7/23/2022 15:23",
"nextBlockId" : "pre 1/27/2020 09:17",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
A Babylonian Example is a source of concrete data to illustrate source code.

Currently, an example is always associated with a method, even if the example refers to a global source of information, each example in a method is its own instance. You can activate each individual instance.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
constants
bpExamplePragmaPrefix
"Should be overridden by subclasses"
^ 'noExample'
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
constants
exampleColors

"These are color brewer colors: https://colorbrewer2.org"
^ #('a6cee3'
'1f78b4'
'b2df8a'
'33a02c'
'fb9a99'
'e31a1c'
'fdbf6f'
'ff7f00'
'cab2d6'
'6a3d9a')
collect: [:colorHexString |
Color fromString: colorHexString]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ serialization
asPragma

<bpRelevantMethod>
^ self subclassResponsibility
self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tracing
currentTrace

^ self traceInformation trace
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tracing
ensureTerminatedProcess
self traceInformation terminateTracingProcess.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
exampleName: aStringOrText

self subclassResponsibility.


Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
exampleName

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
expectedResult: aString
self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
expectedResult
self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
accessing
isActive: aBoolean

aBoolean ~= isActive ifTrue: [
isActive := aBoolean.
aBoolean ~= self isActive ifTrue: [
self setIsActive: aBoolean.
aBoolean
ifTrue: [
self liveSpecimen do: [:aSpecimen |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
isActive

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
method: anObject

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
method

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ui
morphClass

self subclassResponsibility.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ newExpectedResultObject
| result |
self expectedResult isSymbol ifTrue: [
^ self method methodClass perform: self expectedResult].
(self isLiveSpecimenReference: self expectedResult) ifTrue: [
self expectedResult isLiveSpecimenReference ifTrue: [
^ self resolveLiveSpecimen: self expectedResult].

result := Compiler evaluate: self expectedResult.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ tracing
removeTrace

self ensureTerminatedProcess.
traceInformation trace: nil.
self traceInformation trace: nil.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tracing
resumeTracing
^ self traceInformation resumeProcess
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
executing
runOn: initialState

^ self subclassResponsibility
self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
executing
runWithTimeoutOn: initialState
| complete semaphore |
semaphore := Semaphore new.
complete := false.

self startWatchdog: [
semaphore waitTimeoutMSecs: self timeout.
"We sadly cannot simply ask self tracingIsStillRunning as the values rely
on this method's return value which is not done at this point. So uglyish complete workaround"
complete ifFalse: [self suspendTracingProcess]].

[ ^ self runOn: initialState] ensure: [
complete := true.
semaphore signal]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
setIsActive: aBoolean

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
setUpScript: aStringOrSymbol

self subclassResponsibility.


Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
setUpScript

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
private
startWatchdog: watchdogBlock

| watchdog |
watchdog := watchdogBlock newProcess.
watchdog priority: Processor timingPriority-1.
watchdog resume.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tracing
suspendTracingProcess

^ self traceInformation suspendProcess
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
tearDownScript: aStringOrSymbol

self subclassResponsibility.


Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
tearDownScript

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
timeout: aMSNumber

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
timeout

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tracing
trace

<bpRelevantMethod>
^ self traceInformation trace: ([self execute] bpTraceForExample: self)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
tracing
traceInBackground

<bpRelevantMethod>
| traceAndProcess |
self ensureTerminatedProcess.

traceAndProcess := [self execute] bpTraceInBackgroundForExample: self.
self traceInformation
trace: traceAndProcess first;
tracingProcess: traceAndProcess second.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
traceInformation

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tracing
tracingIsStillRunning

^ self traceInformation tracingIsStillRunning
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tracing
tracingProcessIsSuspended

^ self traceInformation isProcessSuspended
Loading

0 comments on commit bc5be74

Please sign in to comment.