X Tutup
Skip to content

Commit 91e13e9

Browse files
committed
sVB 3.1.5
1 parent 16ec3dd commit 91e13e9

36 files changed

+829
-474
lines changed

DiagramHelper/WndSkew.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:c="http://schemas.ncore.com/wpf/xaml/WpfDialogs"
5-
Title="Skew Trnasform" Width="500" x:Name="Skew"
5+
Title="Skew Transform" Width="500" x:Name="Skew"
66
SizeToContent="Height" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
77

88
<StackPanel Margin="5">

Readme.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<b><center><span style="font-size:3em;">Small Visual Basic 3.1:</span>
1+
<b><center><span style="font-size:3em;">Small Visual Basic 3.1.5:</span>
22
<br><br>
33
<span style="font-size:2em;">You can download the sVB installer from the <a href="https://marketplace.visualstudio.com/items?itemName=ModernVBNET.sVBInstaller"><u>VS marketplace</u></a>.</span>
44
<br><br></center></b>
@@ -13,18 +13,18 @@ Small Visual Basic is the visual version of Small Basic, and the small version o
1313
<img src="https://modernvbnet.gallerycdn.vsassets.io/extensions/modernvbnet/svbinstaller/3.0/1714546030343/image__2.png"/>
1414
</p>
1515

16-
* After installing Small Visual Basic, you can double-click the "sVB samples" icon on the desktop to open the sVB samples folder, which is installed on your documents folder with more than 90 samples, including the Ball, Cars, Tetris, Tom and Jerry games, and many other interesting samples.
16+
# Learn Small Visual Basic:
17+
* After installing Small Visual Basic, you can double-click the "sVB samples" icon on the desktop to open the sVB samples folder, which is installed on your documents folder with more than 160 samples, including games, puzzles, drawings, animation, turtle and windows forms samples.
1718

18-
* You can also double-click the "sVB docs" icon on the desktop to open the sVB reference PDF book, which contains the full documentation of the sVB IDE, syntax, and library.
19+
* You can also double-click the "sVB reference book" icon on the desktop to open the sVB reference PDF book, which contains the full documentation of the sVB IDE, syntax, and library. You can Click Ctrl+F and type a name of a type, method, property or event to get more info about. You can also use the links in "How To" section to learn about some interesting fearurs of sVB.
20+
The reference also includes a fulll info about sVB syntax, form designer and code editor.
1921

20-
* The reference book may not be the easiest way for kids and beginners to start learning sVB with, and this is why I am publishing the ["Small Visual Basic Kid Programmer" book series](https://www.amazon.com/dp/B0DNX2ZR4D) on Amazon.
21-
22+
* The reference book may not be the easiest way for kids and beginners to start learning sVB with, and this is why I am publishing the ["Small Visual Basic Kid Programmer" book series](https://www.amazon.com/dp/B0DNX2ZR4D) on Amazon to introduce sVB to kids from 6 years and up. The series also aims to enhance the mathematical skills of the kids based on their educational knowledge in each grade. For example, the 3rd and 4th books of the series can be considered as a geometry course simply introduced by turtle graphics.
2223
<p align="center">
23-
<a href="https://www.amazon.com/dp/B0DNX2ZR4D">
24-
<img src="blob:https://marketplace.visualstudio.com/5280dd5a-f721-4f5e-9064-11699bb3c994"/>
25-
</a>
26-
</p>
24+
<a href="https://www.amazon.com/dp/B0DNX2ZR4D"><img src="https://m.media-amazon.com/images/I/81ey+FtB8KL._CLa%7C2893,2214%7C71XQRjHURJL.jpg,71dj-VHkYOL.jpg%7C0,0,1315,2214+1578,0,1315,2214+657,0,1578,2214_._SY300_.jpg"/></a></p>
2725

26+
* You can also use all available Small Basic educational resources to get started with sVB. You can run Small Basic sample in sVB with 0 or few modifications. For more information, see the "Fix SB variable issues in sVB" topic in the "How To" section in the sVB reference book.
27+
2828
# sVB 3.0 says: Happy BASIC 60th anniversary for all!
2929
In 1 May, 1964, John G. Kemeny and Thomas E. Kurtz created BASIC, which became the easiest and most popular programming language ever, with more than 300 different dialects that emerged and vanished over time.
3030
<p align="center">
@@ -105,7 +105,7 @@ Thread.SubToRun = Task2
105105
```
106106

107107
* Small Visual Basic is easier than Python for kids and young beginners!
108-
1. Python is a full stack language, while sVB is only for desktop apps and only for educational purposes, which make it more focused on its purpose. But this doesn't mean sVB has no future, or it is just a toy. It is actually the doorway to a popular and powerful development platform: the DotNET and VS .NET. It is easy to use your understanding of sVB syntax, library, form designer, and even the code editor experience to move to VB .NET (and later to C# if you want). But actually sVB has some advanced topics, like designing a multi-form application, using XAML styles, using multi-threading and creating code libraries. sVB also comes with the LitDev external library that contains a 3D engine and a Physics engine, which allows endless advanced possibilities.
108+
1. Python is a full stack language, while sVB is only for desktop apps and only for educational purposes, which make it more focused on its purpose. But this doesn't mean sVB has no future, or it is just a toy. It is actually the doorway to a popular and powerful development platform: the DotNET and VS .NET. It is easy to use your understanding of sVB syntax, library, form designer, and even the code editor experience to move to VB .NET (and later to C# if you want). But actually sVB has some advanced topics, like designing a multi-form application, using XAML styles, using multi-threading and creating code libraries. sVB also comes with the LitDev external library that contains a 3D engine and a Physics engine, which allows endless advanced possibilities.
109109
2. Both Python and sVB are dynamically typed languages, but sVB is easier in this aspect, because it doesn't require type conversions.
110110
3. Python is case-sensitive (and surprisingly, the True and False keywords starts with uppercase letters), while sVB is case-insensitive, and the code editor makes sure to fix words to their original casing. This makes it more easier to learn.
111111
4. Python lists have 0-based indexes, while sVB arrays by default have 1-based indexes, which is more natural and easier for kids to deal with, but nothing prevents them from using the 0 index or even negative indexes, because arrays in sVB are actually dictionaries, so indexes are actually keys!

SBCompiler/SBCompiler/Expressions/NothingExpression.vb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ Namespace Microsoft.SmallVisualBasic.Expressions
5656
End Function
5757

5858
Public Overrides Function ToVB() As String
59-
' Must use RemoveHandler in VB
60-
' ToDo: Replace handler with the subroutine name!
61-
Dim s = CType(Me.Parent, Statements.AssignmentStatement)
62-
Return $"RemoveHandler {s.LeftValue}, handler"
59+
Return NothingToken.Text
6360
End Function
6461
End Class
6562

SBCompiler/SBCompiler/Expressions/PropertyExpression.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Namespace Microsoft.SmallVisualBasic.Expressions
127127

128128
Public Overrides Function ToVB() As String
129129
If IsDynamic Then
130-
Return $"{TypeName.Text}({PropertyName.Text})"
130+
Return $"{TypeName.Text}(""{PropertyName.Text}"")"
131131
End If
132132
Return $"{TypeName.Text}.{PropertyName.Text}"
133133
End Function

SBCompiler/SBCompiler/Statements/AssignmentStatement.vb

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,41 @@ Namespace Microsoft.SmallVisualBasic.Statements
423423
})
424424
End Sub
425425

426-
Public Overrides Function ToVB() As String
426+
Public Overrides Function ToVB(symbolTable As SymbolTable) As String
427+
Dim prop = TryCast(LeftValue, PropertyExpression)
428+
If prop IsNot Nothing Then
429+
If prop.IsEvent Then
430+
If RightValue.StartToken.Type = TokenType.Nothing Then
431+
Return $"RemoveHandler {prop.ToVB}, Nothing"
432+
End If
433+
Return $"AddHandler {prop.ToVB}, AddressOf {RightValue.ToVB}"
434+
End If
435+
436+
If prop.IsDynamic AndAlso NeedsDefinition(symbolTable) Then
437+
Return $"Dim {prop.TypeName.Text} As Primitive" & vbCrLf &
438+
$"{prop.TypeName.Text}(""{prop.PropertyName.Text}"") = {RightValue.ToVB}" & vbCrLf
439+
End If
440+
441+
Return $"{prop.ToVB} = {RightValue.ToVB}" & vbCrLf
442+
End If
443+
444+
If NeedsDefinition(symbolTable) Then
445+
Dim arr = TryCast(LeftValue, ArrayExpression)
446+
If arr Is Nothing Then
447+
Return $"Dim {LeftValue.ToVB} = {RightValue.ToVB}" & vbCrLf
448+
End If
449+
450+
Return $"Dim {arr.StartToken.Text} As Primitive" & vbCrLf &
451+
$"{arr.ToVB} = {RightValue.ToVB}" & vbCrLf
452+
End If
453+
427454
Return $"{LeftValue.ToVB} = {RightValue.ToVB}" & vbCrLf
428455
End Function
456+
457+
Private Function NeedsDefinition(symbolTable As SymbolTable) As Boolean
458+
Dim id = LeftValue.StartToken
459+
Dim defID = symbolTable.GetDefinitionIdentifier(id)
460+
Return defID.IsIllegal OrElse defID.Line <> id.Line OrElse defID.Column = id.Column
461+
End Function
429462
End Class
430463
End Namespace

SBCompiler/SBCompiler/Statements/ElseIfStatement.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ Namespace Microsoft.SmallVisualBasic.Statements
6969
Return runner.Execute(ThenStatements)
7070
End Function
7171

72-
Public Overrides Function ToVB() As String
72+
Public Overrides Function ToVB(symbolTable As SymbolTable) As String
7373
Dim sb As New StringBuilder()
7474
sb.AppendLine($"{ElseIfToken.Text} {Condition.ToVB()} {ThenToken.Text}")
7575

7676
For Each st In ThenStatements
7777
sb.Append(" ")
78-
sb.Append(st.ToVB())
78+
sb.Append(st.ToVB(symbolTable))
7979
Next
8080

8181
Return sb.ToString()

SBCompiler/SBCompiler/Statements/EmptyStatement.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Namespace Microsoft.SmallVisualBasic.Statements
1717
Return Nothing
1818
End Function
1919

20-
Public Overrides Function ToVB() As String
20+
Public Overrides Function ToVB(symbolTable As SymbolTable) As String
2121
Return EndingComment.Text & vbCrLf
2222
End Function
2323
End Class

SBCompiler/SBCompiler/Statements/EndDebugging.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Namespace Microsoft.SmallVisualBasic.Statements
1515
Return Me
1616
End Function
1717

18-
Public Overrides Function ToVB() As String
18+
Public Overrides Function ToVB(symbolTable As SymbolTable) As String
1919
Return ""
2020
End Function
2121
End Class

SBCompiler/SBCompiler/Statements/ForEachStatement.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,13 @@ Namespace Microsoft.SmallVisualBasic.Statements
294294
Return Nothing
295295
End Function
296296

297-
Public Overrides Function ToVB() As String
297+
Public Overrides Function ToVB(symbolTable As SymbolTable) As String
298298
Dim sb As New StringBuilder()
299299
sb.AppendLine($"For Each {Iterator.Text} In {ArrayExpression.ToVB}")
300300

301301
For Each st In Body
302302
sb.Append(" ")
303-
sb.Append(st.ToVB())
303+
sb.Append(st.ToVB(symbolTable))
304304
Next
305305

306306
sb.Append(EndLoopToken.Text)

SBCompiler/SBCompiler/Statements/ForStatement.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ Namespace Microsoft.SmallVisualBasic.Statements
448448
Return Nothing
449449
End Function
450450

451-
Public Overrides Function ToVB() As String
451+
Public Overrides Function ToVB(symbolTable As SymbolTable) As String
452452
Dim sb As New StringBuilder()
453453
sb.Append($"{ForToken.Text} {Iterator.Text} = {_InitialValue.ToVB} To {_FinalValue.ToVB}")
454454

@@ -460,7 +460,7 @@ Namespace Microsoft.SmallVisualBasic.Statements
460460

461461
For Each st In Body
462462
sb.Append(" ")
463-
sb.Append(st.ToVB())
463+
sb.Append(st.ToVB(symbolTable))
464464
Next
465465

466466
sb.AppendLine(EndLoopToken.Text)

0 commit comments

Comments
 (0)
X Tutup