Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Microsoft Small Basic

From Wikipedia, the free encyclopedia
Programming language dialect and development environment
icon
This articlerelies excessively onreferences toprimary sources. Please improve this article by addingsecondary or tertiary sources.
Find sources: "Microsoft Small Basic" – news ·newspapers ·books ·scholar ·JSTOR
(April 2022) (Learn how and when to remove this message)
This article is about the Microsoft programming language. For the GPL programming language, seeSmallBASIC.
Microsoft Small Basic
ParadigmStructured,imperative,object-oriented
Designed byMicrosoft,Vijaye Raji[1][2]
DeveloperMicrosoft
First appearedOctober 23, 2008; 17 years ago (2008-10-23)[3][4]
Stable release
v1.2 / October 1, 2015; 10 years ago (2015-10-01)[5]
Typing disciplineDynamic,weak
Platform.NET Framework 4.5[5]
OSSmall Basic Desktop:Windows XP (up to version 1.0),Windows Vista,Windows 7,Windows 8,Windows 8.1,Windows 10,Windows Server 2008 R2[6]
Small Basic Online:web browser
LicenseMIT License[7]
Filename extensions.sb,.smallbasic
Websitesmallbasic-publicwebsite.azurewebsites.net
Influenced by
Logo,QBasic,Visual Basic .NET

Microsoft Small Basic is aprogramming language,interpreter and associatedIDE.Microsoft's simplified variant ofBASIC, it is designed to help students who have learntvisual programming languages such asScratch learn text-based programming.[8] The associated IDE provides a simplified programming environment with functionality such assyntax highlighting,intelligent code completion, and in-editor documentation access.[9] The language has only 14 keywords.[10]

History

[edit]
VersionRelease date
Unsupported: v0.1October 23, 2008[3]
Unsupported: v0.2December 17, 2008[11]
Unsupported: v0.3February 10, 2009[12]
Unsupported: v0.4April 14, 2009[13]
Unsupported: v0.5June 16, 2009[14]
Unsupported: v0.6August 19, 2009[15]
Unsupported: v0.7October 23, 2009[4]
Unsupported: v0.8February 4, 2010[16]
Unsupported: v0.9June 11, 2010[17]
Unsupported: v0.91November 17, 2010[18]
Unsupported: v0.95February 8, 2011[19]
Supported: v1.0July 12, 2011[20]
Unsupported: v1.1March 27, 2015[21]
Latest version:v1.2October 1, 2015[5]
Legend:
Unsupported
Supported
Latest version
Preview version
Future version
Legend:
Unsupported
Supported
Latest version
Preview version
Future version

Microsoft announced Small Basic in October 2008,[3] and released the first stable version for distribution on July 12, 2011,[20] on aMicrosoft Developer Network (MSDN) website, together with a teaching curriculum[22] and an introductory guide.[23] Between announcement and stable release, a number ofCommunity Technology Preview (CTP) releases were made.

On March 27, 2015, Microsoft released Small Basic version 1.1,[21] which fixed a bug and upgraded the targeted.NET Framework version from version 3.5 to version 4.5, making it the first version incompatible withWindows XP.

Microsoft released Small Basic version 1.2 on October 1, 2015.[5] Version 1.2 was the first update after a four-year hiatus to introduce new features to Small Basic. The update added classes for working with Microsoft'sKinect motion sensors,[5] increased the number of languages supported by the included Dictionary object, and fixed a number of bugs.[6]

On February 19, 2019, Microsoft announced Small Basic Online (SBO). It isopen source software released underMIT License onGitHub.[24][25]

Language

[edit]

In Small Basic, one writes the illustrative"Hello, World!" program as follows:

TextWindow.WriteLine("Hello, World!")

Microsoft Small Basic isTuring complete. It supportsconditional branching,loop structures, andsubroutines forevent handling.Variables areweakly typed anddynamic with no scoping rules.

Conditional branching

[edit]

The following example demonstrates conditional branching. It ask the user forCelsius orFahrenheit and then comments on the answer in the appropriate temperature unit.

' A Program that gives advice at a requested temperature.TextWindow.WriteLine("Do you use 'C'elsius or 'F'ahrenheit for temperature?")TextWindow.WriteLine("Enter C for Celsius and F for Fahrenheit:")question_temp:' Label to jump back to input if wrong input was giventempunit=TextWindow.Read()' Temperature Definitions in Celsius:tempArray["hot"]=30' 30 °C equals 86 °FtempArray["pretty"]=20' 20 °C equals 68 °FtempArray["cold"]=15' 15 °C equals 59 °FIftempunit="C"ORtempunit="c"ThenTextWindow.WriteLine("Celsius selected!")tempunit="C"' Could be lowercase, thus make it uppercaseElseIftempunit="F"ORtempunit="f"ThenTextWindow.WriteLine("Fahrenheit selected!")' We calculate the temperature values for Fahrenheit based on the Celsius valuestempArray["hot"]=((tempArray["hot"]*9)/5)+32tempArray["pretty"]=((tempArray["pretty"]*9)/5)+32tempArray["cold"]=((tempArray["cold"]*9)/5)+32tempunit="F"' Could be lowercase, thus make it uppercaseElseGOTOquestion_temp' Wrong input, jump back to label "question_temp"EndIfTextWindow.Write("Enter the temperature today (in "+tempunit+"): ")temp=TextWindow.ReadNumber()Iftemp>=tempArray["hot"]ThenTextWindow.WriteLine("It is pretty hot.")ElseIftemp>=tempArray["pretty"]ThenTextWindow.WriteLine("It is pretty nice.")ElseIftemp>=tempArray["cold"]ThenTextWindow.WriteLine("Don't forget your coat.")ElseTextWindow.WriteLine("Stay home.")EndIf

Small Basic does not support an inlineIf statement as doesVisual Basic, for example:

Iftemp>50ThenTextWindow.WriteLine("It is pretty nice.")

Looping

[edit]

This example demonstrates a loop. Starting from one and ending with ten, it multiplies each number by four and displays the result of the multiplication.

TextWindow.WriteLine("Multiplication Tables")Fori=1To10TextWindow.Write(i*4)EndFor

Whileloops are also supported, and the demonstratedForloop can be augmented through the use of theStep keyword. TheStep keyword is used in setting the value by which the counter variable,i, is incremented each iteration.

Data types

[edit]

Small Basic supports basicdata types, likestrings,integers anddecimals, and will readily convert one type to another as required by the situation. In the example, both theRead andReadNumber methods read a string from the command line, butReadNumber rejects any non-numeric characters. This allows the string to be converted to a numeric type and treated as a number rather than a string by the+ operator.

TextWindow.WriteLine("Enter your name: ")name=TextWindow.Read()TextWindow.Write("Enter your age: ")age=TextWindow.ReadNumber()TextWindow.WriteLine("Hello, "+name+"!")TextWindow.WriteLine("In 5 years, you shall be "+(age+5)+" years old!")

As Small Basic will readily convert among data types, numbers can be manipulated as strings and numeric strings as numbers. This is demonstrated through the second example.

TextWindow.WriteLine(Math.log("100"))'Prints 2TextWindow.WriteLine("100"+"3000")' Prints 3100TextWindow.WriteLine("Windows "+8)' Prints Windows 8TextWindow.WriteLine(Text.GetLength(1023.42))' Prints 7 (length of decimal representation including decimal point)

In the second example, both strings are treated as numbers and added together, producing the output 3100. Toconcatenate the two values, producing the output 1003000, it is necessary to use theText.Append(text1,text2) method.

Libraries

[edit]

Standard library

[edit]

The Small Basicstandard library includes basic classes for mathematics,string handling, andinput/output, as well as more exotic classes that are intended to make using the language more fun for learners. Examples of these include aTurtle graphics class, a class for retrieving photos fromFlickr, and classes for interacting with Microsoft Kinect sensors.[26]

To make the classes easier to use for learners, they have been simplified. This simplification is demonstrated through the code used to retrieve a random mountain-themed image from Flickr:

Fori=1To10pic=Flickr.GetRandomPicture("mountains")Desktop.SetWallPaper(pic)Program.Delay(10000)EndFor

Turtle graphics

[edit]

Small Basic includes a "Turtle" graphics library that borrows from theLogo family of programming languages. For example, to draw a square using the turtle, the turtle is moved forward by a given number of pixels and rotated 90 degrees in a given direction. This action is then repeated four times to draw the four sides of the square.

Fori=1to4Turtle.Move(100)' Forward 100 pixelsTurtle.Turn(90)' Turn 90 degrees rightEndFor

More complex drawings are possible by altering the turning angle of the turtle and the number of iterations of the loop. For example, one can draw ahexagon by setting the turn angle to 60 degrees and the number of iterations to six.

Third-party libraries

[edit]

Small Basic allows the use of third-party libraries. These libraries must be written in aCLR-compatible language, and the compiled binaries must target a compatible .NET Framework version. The classes provided by the library are required to bestatic, flagged with a specificattribute, and must use a specific data type.

An example of a class to be used in Small Basic is provided below, written inC#.

[SmallBasicType]publicstaticclassExampleClass{publicstaticPrimitiveAdd(PrimitiveA,PrimitiveB)=>A+B;publicstaticPrimitiveSomeProperty{get;set;}publicstaticPrimitivePi=>(Primitive)3.14159;}

If available, the Small Basic development environment will display documentation for third-party libraries. The development environment accepts documentation in the form of anXML file, which can be automatically generated from source code comments by tools such asMicrosoft Visual Studio andMonoDevelop.[27]

References

[edit]
  1. ^Conrod, Philip; Tylee, Lou (February 2013).Programming Games with Microsoft Small Basic. Kidware Software, LLC.ISBN 978-1-937161-56-9.
  2. ^"Featured Article: Interviews with Vijaye Raji, the creator of Small Basic".TECHCOMMUNITY.MICROSOFT.COM. 13 February 2019.
  3. ^abcRaji, Vijaye (23 October 2008)."Hello World".Small Basic. MSDN Blogs. Microsoft. Retrieved9 February 2014.
  4. ^abRaji, Vijaye (23 October 2009)."Happy Birthday Small Basic".Small Basic. MSDN Blogs. Microsoft. Retrieved27 September 2015.
  5. ^abcdeScherotter, Michael (1 October 2015)."Small Basic 1.2 Released with Kinect Support and Bug Fixes".Small Basic. MSDN Blogs. Microsoft. Retrieved2 October 2015.
  6. ^ab"Download Microsoft Small Basic 1.2 from Official Microsoft Download Centre".Small Basic. Microsoft. 1 October 2015. Retrieved2 October 2015.
  7. ^"SmallBasic".GitHub. 17 October 2021.
  8. ^"Small Basic". Retrieved6 September 2020.
  9. ^Price, Ed (22 October 2012)."The Unique Features of Small Basic".Small Basic. TechNet. Microsoft. Archived fromthe original on 28 April 2015. Retrieved22 April 2015.
  10. ^Price, Ed (8 October 2012)."What are the 14 Keywords of Small Basic?".Small Basic. MSDN Blogs. Microsoft. Retrieved9 February 2014.
  11. ^Raji, Vijaye (17 December 2008)."Announcing Small Basic v0_2!".Small Basic. MSDN Blogs. Microsoft. Retrieved27 September 2015.
  12. ^Raji, Vijaye (10 February 2009)."Microsoft Small Basic v0.3 is here".Small Basic. MSDN Blogs. Microsoft. Retrieved27 September 2015.
  13. ^Raji, Vijaye (14 April 2009)."v0.4 of Small Basic says "Bonjour"".Small Basic. MSDN Blogs. Microsoft. Retrieved27 September 2015.
  14. ^Raji, Vijaye (16 June 2009)."The newest, leanest and the meanest is here!".Small Basic. MSDN Blogs. Microsoft. Retrieved27 September 2015.
  15. ^Raji, Vijaye (19 August 2009)."Now available: Small Basic v0.6".Small Basic. MSDN Blogs. Microsoft. Retrieved27 September 2015.
  16. ^Raji, Vijaye (10 February 2010)."Small Basic v0.8".Small Basic. MSDN Blogs. Microsoft. Retrieved27 September 2015.
  17. ^Raji, Vijaye (11 June 2010)."Small Basic V0.9 is here!".Small Basic. MSDN Blogs. Microsoft. Retrieved27 September 2015.
  18. ^Aldana, Sandra (17 November 2010)."Small Basic V0.91 is more international than ever!".Small Basic. MSDN Blogs. Microsoft. Retrieved27 September 2015.
  19. ^Aldana, Sandra (8 February 2011)."Small Basic v0.95 speaks another language!".Small Basic. MSDN Blogs. Microsoft. Retrieved27 September 2015.
  20. ^abAldana, Sandra (12 July 2011)."Small Basic 1.0 is here!".Small Basic. MSDN Blogs. Microsoft. Retrieved27 September 2015.
  21. ^abPrice, Ed (27 March 2015)."Small Basic 1.1 is here!".Small Basic. MSDN Blogs. Microsoft. Retrieved27 September 2015.
  22. ^Price, Ed (29 April 2014)."Small Basic Curriculum".TechNet. Microsoft. Retrieved9 February 2014.
  23. ^Price, Ed; Takahashi, Nonki (25 February 2014)."Small Basic Getting Started Guide".TechNet. Microsoft. Retrieved12 February 2015.
  24. ^"Announcing Small Basic Online 1.0 – Public Preview". 20 February 2019.
  25. ^"TechNet Wiki". 17 January 2024.
  26. ^"System Requirements Kinect for Small Basic".ininet.org.
  27. ^Protalinski, Emil (17 November 2008)."Yet another programming language from Microsoft: Small Basic".Ars Technica.

Further reading

[edit]

External links

[edit]
Wikibooks has a book on the topic of:Windows Programming
Dialects of theBASIC programming language (list)
Classic
Microsoft
Texas Instruments
Hewlett-Packard
Locomotive Software
Microcomputers
Minicomputers
Time-sharing computers
Other
Extenders
Procedure-
oriented
Proprietary
Free and
open source
Withobject
extensions
Proprietary
Free and
open source
RAD
designers
Proprietary
Free and
open source
Defunct
Implementations
Architecture
Components
Tools
Decompilers
Obfuscators
IDEs
Organizations
Microsoft development tools
Development
environments
Visual Studio
Others
Languages
APIs and
frameworks
Native
.NET
Device drivers
Database
SQL Server
SQL services
Other
Source control
Testing and
debugging
Delivery
Overview
Software
Applications
Video games
Programming
languages
Frameworks,
development tools
Operating systems
Other
Licenses
Forges
Related
C,C++
Open source
Freeware
Retail
Discontinued
Java
Open source
Freeware
Retail
Discontinued
JavaScript
Open source
Haxe
CLI (.NET)
Open source
Freeware
Retail
Discontinued
Flash
PHP
Open source
Proprietary
R
Python
Open source
Proprietary
Pascal,
Object
Pascal
Open source
Freeware
Retail
Discontinued
BASIC
Open source
Freeware
Retail
Discontinued
Go
Open source
Freeware
Retail
Eiffel
POP-11
Online
Retrieved from "https://en.wikipedia.org/w/index.php?title=Microsoft_Small_Basic&oldid=1320955187"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp