Skip to content

Commit

Permalink
vbs: add DEBUG-EVAL
Browse files Browse the repository at this point in the history
  • Loading branch information
asarhaddon committed Oct 23, 2024
1 parent 82518e4 commit e317748
Show file tree
Hide file tree
Showing 8 changed files with 178 additions and 0 deletions.
23 changes: 23 additions & 0 deletions impls/vbs/step3_env.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,34 @@ Function Read(strCode)
Set Read = ReadString(strCode)
End Function

Sub DebugEval(objCode, objEnv)
Dim value, bool
Set value = objEnv.Get("DEBUG-EVAL")
If TypeName(value) = "Nothing" Then
bool = False
Else
Select Case value.Type
Case TYPES.NIL
bool = False
Case TYPES.BOOLEAN
bool = value.Value
Case Else
bool = True
End Select
End If
If bool Then
IO.WriteLine "EVAL: " + Print(objCode)
End If
End Sub

Function Evaluate(objCode, objEnv)
If TypeName(objCode) = "Nothing" Then
Set Evaluate = Nothing
Exit Function
End If

DebugEval objCode, objEnv

Dim varRet, objFirst
If objCode.Type = TYPES.LIST Then
If objCode.Count = 0 Then ' ()
Expand Down
23 changes: 23 additions & 0 deletions impls/vbs/step4_if_fn_do.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,34 @@ Function Read(strCode)
Set Read = ReadString(strCode)
End Function

Sub DebugEval(objCode, objEnv)
Dim value, bool
Set value = objEnv.Get("DEBUG-EVAL")
If TypeName(value) = "Nothing" Then
bool = False
Else
Select Case value.Type
Case TYPES.NIL
bool = False
Case TYPES.BOOLEAN
bool = value.Value
Case Else
bool = True
End Select
End If
If bool Then
IO.WriteLine "EVAL: " + Print(objCode)
End If
End Sub

Function Evaluate(objCode, objEnv)
If TypeName(objCode) = "Nothing" Then
Set Evaluate = Nothing
Exit Function
End If

DebugEval objCode, objEnv

Dim varRet, objFirst
If objCode.Type = TYPES.LIST Then
If objCode.Count = 0 Then ' ()
Expand Down
22 changes: 22 additions & 0 deletions impls/vbs/step5_tco.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,35 @@ Function Read(strCode)
Set Read = ReadString(strCode)
End Function

Sub DebugEval(objCode, objEnv)
Dim value, bool
Set value = objEnv.Get("DEBUG-EVAL")
If TypeName(value) = "Nothing" Then
bool = False
Else
Select Case value.Type
Case TYPES.NIL
bool = False
Case TYPES.BOOLEAN
bool = value.Value
Case Else
bool = True
End Select
End If
If bool Then
IO.WriteLine "EVAL: " + Print(objCode)
End If
End Sub

Function Evaluate(ByVal objCode, ByVal objEnv)
While True
If TypeName(objCode) = "Nothing" Then
Set Evaluate = Nothing
Exit Function
End If

DebugEval objCode, objEnv

Dim varRet, objFirst
If objCode.Type = TYPES.LIST Then
If objCode.Count = 0 Then ' ()
Expand Down
22 changes: 22 additions & 0 deletions impls/vbs/step6_file.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,35 @@ Function Read(strCode)
Set Read = ReadString(strCode)
End Function

Sub DebugEval(objCode, objEnv)
Dim value, bool
Set value = objEnv.Get("DEBUG-EVAL")
If TypeName(value) = "Nothing" Then
bool = False
Else
Select Case value.Type
Case TYPES.NIL
bool = False
Case TYPES.BOOLEAN
bool = value.Value
Case Else
bool = True
End Select
End If
If bool Then
IO.WriteLine "EVAL: " + Print(objCode)
End If
End Sub

Function Evaluate(ByVal objCode, ByVal objEnv)
While True
If TypeName(objCode) = "Nothing" Then
Set Evaluate = Nothing
Exit Function
End If

DebugEval objCode, objEnv

Dim varRet, objFirst
If objCode.Type = TYPES.LIST Then
If objCode.Count = 0 Then ' ()
Expand Down
22 changes: 22 additions & 0 deletions impls/vbs/step7_quote.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,35 @@ Function Read(strCode)
Set Read = ReadString(strCode)
End Function

Sub DebugEval(objCode, objEnv)
Dim value, bool
Set value = objEnv.Get("DEBUG-EVAL")
If TypeName(value) = "Nothing" Then
bool = False
Else
Select Case value.Type
Case TYPES.NIL
bool = False
Case TYPES.BOOLEAN
bool = value.Value
Case Else
bool = True
End Select
End If
If bool Then
IO.WriteLine "EVAL: " + Print(objCode)
End If
End Sub

Function Evaluate(ByVal objCode, ByVal objEnv)
While True
If TypeName(objCode) = "Nothing" Then
Set Evaluate = Nothing
Exit Function
End If

DebugEval objCode, objEnv

Dim varRet, objFirst
If objCode.Type = TYPES.LIST Then
If objCode.Count = 0 Then ' ()
Expand Down
22 changes: 22 additions & 0 deletions impls/vbs/step8_macros.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,35 @@ Function Read(strCode)
Set Read = ReadString(strCode)
End Function

Sub DebugEval(objCode, objEnv)
Dim value, bool
Set value = objEnv.Get("DEBUG-EVAL")
If TypeName(value) = "Nothing" Then
bool = False
Else
Select Case value.Type
Case TYPES.NIL
bool = False
Case TYPES.BOOLEAN
bool = value.Value
Case Else
bool = True
End Select
End If
If bool Then
IO.WriteLine "EVAL: " + Print(objCode)
End If
End Sub

Function Evaluate(ByVal objCode, ByVal objEnv)
While True
If TypeName(objCode) = "Nothing" Then
Set Evaluate = Nothing
Exit Function
End If

DebugEval objCode, objEnv

Dim varRet, objFirst
If objCode.Type = TYPES.LIST Then
If objCode.Count = 0 Then ' ()
Expand Down
22 changes: 22 additions & 0 deletions impls/vbs/step9_try.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,35 @@ Function Read(strCode)
Set Read = ReadString(strCode)
End Function

Sub DebugEval(objCode, objEnv)
Dim value, bool
Set value = objEnv.Get("DEBUG-EVAL")
If TypeName(value) = "Nothing" Then
bool = False
Else
Select Case value.Type
Case TYPES.NIL
bool = False
Case TYPES.BOOLEAN
bool = value.Value
Case Else
bool = True
End Select
End If
If bool Then
IO.WriteLine "EVAL: " + Print(objCode)
End If
End Sub

Function Evaluate(ByVal objCode, ByVal objEnv)
While True
If TypeName(objCode) = "Nothing" Then
Set Evaluate = Nothing
Exit Function
End If

DebugEval objCode, objEnv

Dim varRet, objFirst
If objCode.Type = TYPES.LIST Then
If objCode.Count = 0 Then ' ()
Expand Down
22 changes: 22 additions & 0 deletions impls/vbs/stepA_mal.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,35 @@ Function Read(strCode)
Set Read = ReadString(strCode)
End Function

Sub DebugEval(objCode, objEnv)
Dim value, bool
Set value = objEnv.Get("DEBUG-EVAL")
If TypeName(value) = "Nothing" Then
bool = False
Else
Select Case value.Type
Case TYPES.NIL
bool = False
Case TYPES.BOOLEAN
bool = value.Value
Case Else
bool = True
End Select
End If
If bool Then
IO.WriteLine "EVAL: " + Print(objCode)
End If
End Sub

Function Evaluate(ByVal objCode, ByVal objEnv)
While True
If TypeName(objCode) = "Nothing" Then
Set Evaluate = Nothing
Exit Function
End If

DebugEval objCode, objEnv

Dim varRet, objFirst
If objCode.Type = TYPES.LIST Then
If objCode.Count = 0 Then ' ()
Expand Down

0 comments on commit e317748

Please sign in to comment.