initial
This commit is contained in:
parent
a30d13392e
commit
fed33b6281
825
doc/sBasic.pdf
Normal file
825
doc/sBasic.pdf
Normal file
|
@ -0,0 +1,825 @@
|
||||||
|
%PDF-1.4
|
||||||
|
%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com
|
||||||
|
1 0 obj
|
||||||
|
<< /F1 2 0 R /F2 3 0 R /F3 26 0 R >>
|
||||||
|
endobj
|
||||||
|
2 0 obj
|
||||||
|
<< /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >>
|
||||||
|
endobj
|
||||||
|
3 0 obj
|
||||||
|
<< /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font >>
|
||||||
|
endobj
|
||||||
|
4 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 27 0 R /XYZ 62.69291 468.0236 0 ] /Rect [ 62.69291 663.0236 127.7229 675.0236 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
5 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 27 0 R /XYZ 62.69291 468.0236 0 ] /Rect [ 527.0227 663.7736 532.5827 675.7736 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
6 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 27 0 R /XYZ 62.69291 375.0236 0 ] /Rect [ 62.69291 645.0236 209.9629 657.0236 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
7 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 27 0 R /XYZ 62.69291 375.0236 0 ] /Rect [ 527.0227 645.7736 532.5827 657.7736 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
8 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 27 0 R /XYZ 62.69291 342.0236 0 ] /Rect [ 62.69291 627.0236 118.2629 639.0236 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
9 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 27 0 R /XYZ 62.69291 342.0236 0 ] /Rect [ 527.0227 627.7736 532.5827 639.7736 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
10 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 27 0 R /XYZ 62.69291 231.0236 0 ] /Rect [ 82.69291 609.0236 242.7529 621.0236 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
11 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 27 0 R /XYZ 62.69291 231.0236 0 ] /Rect [ 527.0227 609.7736 532.5827 621.7736 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
12 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 28 0 R /XYZ 62.69291 552.6236 0 ] /Rect [ 82.69291 591.0236 186.0729 603.0236 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
13 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 28 0 R /XYZ 62.69291 552.6236 0 ] /Rect [ 527.0227 591.7736 532.5827 603.7736 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
14 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 28 0 R /XYZ 62.69291 387.4236 0 ] /Rect [ 82.69291 573.0236 109.9329 585.0236 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
15 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 28 0 R /XYZ 62.69291 387.4236 0 ] /Rect [ 527.0227 573.7736 532.5827 585.7736 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
16 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 28 0 R /XYZ 62.69291 258.2236 0 ] /Rect [ 82.69291 555.0236 122.1529 567.0236 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
17 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 28 0 R /XYZ 62.69291 258.2236 0 ] /Rect [ 527.0227 555.7736 532.5827 567.7736 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
18 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 29 0 R /XYZ 62.69291 620.6236 0 ] /Rect [ 82.69291 537.0236 169.3829 549.0236 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
19 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 29 0 R /XYZ 62.69291 620.6236 0 ] /Rect [ 527.0227 537.7736 532.5827 549.7736 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
20 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 29 0 R /XYZ 62.69291 519.4236 0 ] /Rect [ 82.69291 519.0236 131.0329 531.0236 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
21 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 29 0 R /XYZ 62.69291 519.4236 0 ] /Rect [ 527.0227 519.7736 532.5827 531.7736 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
22 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 29 0 R /XYZ 62.69291 459.4236 0 ] /Rect [ 82.69291 501.0236 113.8129 513.0236 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
23 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 29 0 R /XYZ 62.69291 459.4236 0 ] /Rect [ 527.0227 501.7736 532.5827 513.7736 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
24 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 29 0 R /XYZ 62.69291 339.4236 0 ] /Rect [ 62.69291 483.0236 208.2929 495.0236 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
25 0 obj
|
||||||
|
<< /Border [ 0 0 0 ] /Contents () /Dest [ 29 0 R /XYZ 62.69291 339.4236 0 ] /Rect [ 527.0227 483.7736 532.5827 495.7736 ] /Subtype /Link /Type /Annot >>
|
||||||
|
endobj
|
||||||
|
26 0 obj
|
||||||
|
<< /BaseFont /Courier /Encoding /WinAnsiEncoding /Name /F3 /Subtype /Type1 /Type /Font >>
|
||||||
|
endobj
|
||||||
|
27 0 obj
|
||||||
|
<< /Annots [ 4 0 R 5 0 R 6 0 R 7 0 R 8 0 R 9 0 R 10 0 R 11 0 R 12 0 R 13 0 R
|
||||||
|
14 0 R 15 0 R 16 0 R 17 0 R 18 0 R 19 0 R 20 0 R 21 0 R 22 0 R 23 0 R
|
||||||
|
24 0 R 25 0 R ] /Contents 45 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 44 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
|
||||||
|
/Trans << >> /Type /Page >>
|
||||||
|
endobj
|
||||||
|
28 0 obj
|
||||||
|
<< /Contents 46 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 44 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
|
||||||
|
/Type /Page >>
|
||||||
|
endobj
|
||||||
|
29 0 obj
|
||||||
|
<< /Contents 47 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 44 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
|
||||||
|
/Type /Page >>
|
||||||
|
endobj
|
||||||
|
30 0 obj
|
||||||
|
<< /Outlines 32 0 R /PageLabels 48 0 R /PageMode /UseNone /Pages 44 0 R /Type /Catalog >>
|
||||||
|
endobj
|
||||||
|
31 0 obj
|
||||||
|
<< /Author () /CreationDate (D:20181002080507+00'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20181002080507+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
|
||||||
|
/Subject (\(unspecified\)) /Title (sBasic -- yet another simple programming language) /Trapped /False >>
|
||||||
|
endobj
|
||||||
|
32 0 obj
|
||||||
|
<< /Count 12 /First 33 0 R /Last 43 0 R /Type /Outlines >>
|
||||||
|
endobj
|
||||||
|
33 0 obj
|
||||||
|
<< /Dest [ 27 0 R /XYZ 62.69291 468.0236 0 ] /Next 34 0 R /Parent 32 0 R /Title (sBasic Usage) >>
|
||||||
|
endobj
|
||||||
|
34 0 obj
|
||||||
|
<< /Dest [ 27 0 R /XYZ 62.69291 375.0236 0 ] /Next 35 0 R /Parent 32 0 R /Prev 33 0 R /Title (sBasic Language Specification) >>
|
||||||
|
endobj
|
||||||
|
35 0 obj
|
||||||
|
<< /Count 7 /Dest [ 27 0 R /XYZ 62.69291 342.0236 0 ] /First 36 0 R /Last 42 0 R /Next 43 0 R /Parent 32 0 R
|
||||||
|
/Prev 34 0 R /Title (Whitespace) >>
|
||||||
|
endobj
|
||||||
|
36 0 obj
|
||||||
|
<< /Dest [ 27 0 R /XYZ 62.69291 231.0236 0 ] /Next 37 0 R /Parent 35 0 R /Title (Variables and Arithmetic Operations) >>
|
||||||
|
endobj
|
||||||
|
37 0 obj
|
||||||
|
<< /Dest [ 28 0 R /XYZ 62.69291 552.6236 0 ] /Next 38 0 R /Parent 35 0 R /Prev 36 0 R /Title (Conditional Statements) >>
|
||||||
|
endobj
|
||||||
|
38 0 obj
|
||||||
|
<< /Dest [ 28 0 R /XYZ 62.69291 387.4236 0 ] /Next 39 0 R /Parent 35 0 R /Prev 37 0 R /Title (Loops) >>
|
||||||
|
endobj
|
||||||
|
39 0 obj
|
||||||
|
<< /Dest [ 28 0 R /XYZ 62.69291 258.2236 0 ] /Next 40 0 R /Parent 35 0 R /Prev 38 0 R /Title (Routines) >>
|
||||||
|
endobj
|
||||||
|
40 0 obj
|
||||||
|
<< /Dest [ 29 0 R /XYZ 62.69291 620.6236 0 ] /Next 41 0 R /Parent 35 0 R /Prev 39 0 R /Title (Special Commands) >>
|
||||||
|
endobj
|
||||||
|
41 0 obj
|
||||||
|
<< /Dest [ 29 0 R /XYZ 62.69291 519.4236 0 ] /Next 42 0 R /Parent 35 0 R /Prev 40 0 R /Title (Comments) >>
|
||||||
|
endobj
|
||||||
|
42 0 obj
|
||||||
|
<< /Dest [ 29 0 R /XYZ 62.69291 459.4236 0 ] /Parent 35 0 R /Prev 41 0 R /Title (Strings) >>
|
||||||
|
endobj
|
||||||
|
43 0 obj
|
||||||
|
<< /Dest [ 29 0 R /XYZ 62.69291 339.4236 0 ] /Parent 32 0 R /Prev 35 0 R /Title (sBasic Application Extensions) >>
|
||||||
|
endobj
|
||||||
|
44 0 obj
|
||||||
|
<< /Count 3 /Kids [ 27 0 R 28 0 R 29 0 R ] /Type /Pages >>
|
||||||
|
endobj
|
||||||
|
45 0 obj
|
||||||
|
<< /Length 5969 >>
|
||||||
|
stream
|
||||||
|
1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 717.0236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 28 Tm /F2 20 Tf 24 TL 34.89488 0 Td (sBasic -- yet another simple programming) Tj T* 156.15 0 Td (language) Tj T* -191.0449 0 Td ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 684.0236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Contents) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 480.0236 cm
|
||||||
|
0 0 0 rg
|
||||||
|
BT /F1 10 Tf 12 TL ET
|
||||||
|
q
|
||||||
|
1 0 0 1 0 183 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (sBasic Usage) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 397.8898 183 cm
|
||||||
|
q
|
||||||
|
0 0 .501961 rg
|
||||||
|
0 0 .501961 RG
|
||||||
|
BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (1) Tj T* -66.44 0 Td ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 165 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (sBasic Language Specification) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 397.8898 165 cm
|
||||||
|
q
|
||||||
|
0 0 .501961 rg
|
||||||
|
0 0 .501961 RG
|
||||||
|
BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (1) Tj T* -66.44 0 Td ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 147 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Whitespace) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 397.8898 147 cm
|
||||||
|
q
|
||||||
|
0 0 .501961 rg
|
||||||
|
0 0 .501961 RG
|
||||||
|
BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (1) Tj T* -66.44 0 Td ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 129 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 20 2 Tm 12 TL /F1 10 Tf 0 0 .501961 rg (Variables and Arithmetic Operations) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 397.8898 129 cm
|
||||||
|
q
|
||||||
|
0 0 .501961 rg
|
||||||
|
0 0 .501961 RG
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 66.44 0 Td (1) Tj T* -66.44 0 Td ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 111 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 20 2 Tm 12 TL /F1 10 Tf 0 0 .501961 rg (Conditional Statements) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 397.8898 111 cm
|
||||||
|
q
|
||||||
|
0 0 .501961 rg
|
||||||
|
0 0 .501961 RG
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 66.44 0 Td (2) Tj T* -66.44 0 Td ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 93 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 20 2 Tm 12 TL /F1 10 Tf 0 0 .501961 rg (Loops) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 397.8898 93 cm
|
||||||
|
q
|
||||||
|
0 0 .501961 rg
|
||||||
|
0 0 .501961 RG
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 66.44 0 Td (2) Tj T* -66.44 0 Td ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 75 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 20 2 Tm 12 TL /F1 10 Tf 0 0 .501961 rg (Routines) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 397.8898 75 cm
|
||||||
|
q
|
||||||
|
0 0 .501961 rg
|
||||||
|
0 0 .501961 RG
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 66.44 0 Td (2) Tj T* -66.44 0 Td ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 57 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 20 2 Tm 12 TL /F1 10 Tf 0 0 .501961 rg (Special Commands) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 397.8898 57 cm
|
||||||
|
q
|
||||||
|
0 0 .501961 rg
|
||||||
|
0 0 .501961 RG
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 66.44 0 Td (3) Tj T* -66.44 0 Td ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 39 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 20 2 Tm 12 TL /F1 10 Tf 0 0 .501961 rg (Comments) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 397.8898 39 cm
|
||||||
|
q
|
||||||
|
0 0 .501961 rg
|
||||||
|
0 0 .501961 RG
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 66.44 0 Td (3) Tj T* -66.44 0 Td ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 21 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 20 2 Tm 12 TL /F1 10 Tf 0 0 .501961 rg (Strings) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 397.8898 21 cm
|
||||||
|
q
|
||||||
|
0 0 .501961 rg
|
||||||
|
0 0 .501961 RG
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 66.44 0 Td (3) Tj T* -66.44 0 Td ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 3 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (sBasic Application Extensions) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 397.8898 3 cm
|
||||||
|
q
|
||||||
|
0 0 .501961 rg
|
||||||
|
0 0 .501961 RG
|
||||||
|
BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (3) Tj T* -66.44 0 Td ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 447.0236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (sBasic Usage) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 417.0236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .616905 Tw (sBasic is designed for freely programmable embedded applications that do not allow scripting languages) Tj T* 0 Tw (like JS, Lua or Python.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 387.0236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .571751 Tw (One should not write applications with it, in contrary it is designed to write extensions for micro controller) Tj T* 0 Tw (projects.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 354.0236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (sBasic Language Specification) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 321.0236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Whitespace) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 291.0236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 14 Tm 2.394269 Tw 12 TL /F1 10 Tf 0 0 0 rg (The following whitespace characters will be converted to a single blank \() Tj /F3 10 Tf 0 0 0 rg (0x20) Tj /F1 10 Tf 0 0 0 rg (\): ) Tj /F3 10 Tf 0 0 0 rg (\\t\\r ) Tj /F1 10 Tf 0 0 0 rg (and multiple) Tj T* 0 Tw (blanks.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 261.0236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 14 Tm .59284 Tw 12 TL /F1 10 Tf 0 0 0 rg (The newline character \() Tj /F3 10 Tf 0 0 0 rg (\\n) Tj /F1 10 Tf 0 0 0 rg (\) is a special character however multiple newline characters will be interpreted) Tj T* 0 Tw (as one.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 243.0236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (A statement always ends with a newline character. Tokens are separated by blanks.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 213.0236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Variables and Arithmetic Operations) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 183.0236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 1.831318 Tw (Variables have data types. Usually they will be integers, but there might be other application specific) Tj T* 0 Tw (datatypes.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 165.0236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Variables have to be declared explicitly using the scheme:) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 131.8236 cm
|
||||||
|
q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 0 cm
|
||||||
|
q
|
||||||
|
1 0 0 1 6.6 6.6 cm
|
||||||
|
q
|
||||||
|
.662745 .662745 .662745 RG
|
||||||
|
.5 w
|
||||||
|
.960784 .960784 .862745 rg
|
||||||
|
n -6 -6 468.6898 24 re B*
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (<) Tj (datatype) Tj (>) Tj ( ) Tj (<) Tj (variablename) Tj (>) Tj ( '=' ) Tj (<) Tj (value) Tj (>) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 99.82362 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 14 Tm 1.016651 Tw 12 TL /F2 10 Tf 0 0 0 rg (Note ) Tj /F1 10 Tf (that variable names must start with an alphabetic character. Variable names can contain after the) Tj T* 0 Tw (first character all of the following characters:) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
|
||||||
|
endstream
|
||||||
|
endobj
|
||||||
|
46 0 obj
|
||||||
|
<< /Length 4567 >>
|
||||||
|
stream
|
||||||
|
1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 739.8236 cm
|
||||||
|
q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 0 cm
|
||||||
|
q
|
||||||
|
1 0 0 1 6.6 6.6 cm
|
||||||
|
q
|
||||||
|
.662745 .662745 .662745 RG
|
||||||
|
.5 w
|
||||||
|
.960784 .960784 .862745 rg
|
||||||
|
n -6 -6 468.6898 24 re B*
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F3 10 Tf 12 TL (a..zA..Z0..9_) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 719.8236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Datatype names must follow the same conventions as the variable name convention.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 701.8236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 0 rg (Note) Tj /F1 10 Tf (: Variables are always global.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 683.8236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is an example for valid variable declarations:) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 626.6236 cm
|
||||||
|
q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 0 cm
|
||||||
|
q
|
||||||
|
1 0 0 1 6.6 6.6 cm
|
||||||
|
q
|
||||||
|
.662745 .662745 .662745 RG
|
||||||
|
.5 w
|
||||||
|
.960784 .960784 .862745 rg
|
||||||
|
n -6 -6 468.6898 48 re B*
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 26 Tm /F3 10 Tf 12 TL (int A = 2) Tj T* (int B = 3) Tj T* (int A_plus_B = 0) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 594.6236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 14 Tm 2.466412 Tw 12 TL /F1 10 Tf 0 0 0 rg (Arithmetic commands are application specific, for integer usually ) Tj /F3 10 Tf 0 0 0 rg (+) Tj ( ) Tj (-) Tj ( ) Tj (*) Tj ( ) Tj (/ ) Tj /F1 10 Tf 0 0 0 rg (are defined. Arithmetic) Tj T* 0 Tw (commands can be grouped by using parenthesis ) Tj /F3 10 Tf 0 0 0 rg (\(\)) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 564.6236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 14 Tm .515988 Tw 12 TL /F3 10 Tf 0 0 0 rg (* ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F3 10 Tf 0 0 0 rg (/ ) Tj /F1 10 Tf 0 0 0 rg (will be executed before ) Tj /F3 10 Tf 0 0 0 rg (+ ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F3 10 Tf 0 0 0 rg (-) Tj /F1 10 Tf 0 0 0 rg (, the inner of parenthesis will be executed before the outer and) Tj T* 0 Tw (by default commands will be executed in the order they appear.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 534.6236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Conditional Statements) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 516.6236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (sBasic knows the if-else-structure:) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 399.4236 cm
|
||||||
|
q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 0 cm
|
||||||
|
q
|
||||||
|
1 0 0 1 6.6 6.6 cm
|
||||||
|
q
|
||||||
|
.662745 .662745 .662745 RG
|
||||||
|
.5 w
|
||||||
|
.960784 .960784 .862745 rg
|
||||||
|
n -6 -6 468.6898 108 re B*
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 86 Tm 12 TL /F3 10 Tf 0 0 0 rg (IF ) Tj (<) Tj (expr) Tj (>) Tj T* (THEN) Tj T* ( ) Tj (<) Tj (statement) Tj (>) Tj T* ( {) Tj (<) Tj (statement) Tj (>) Tj (}) Tj T* ([ELSE) Tj T* ( ) Tj (<) Tj (statement) Tj (>) Tj T* ( {) Tj (<) Tj (statement) Tj (>) Tj (}]) Tj T* (FI) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 369.4236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Loops) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 351.4236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (sBasic knows the while-loop:) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 270.2236 cm
|
||||||
|
q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 0 cm
|
||||||
|
q
|
||||||
|
1 0 0 1 6.6 6.6 cm
|
||||||
|
q
|
||||||
|
.662745 .662745 .662745 RG
|
||||||
|
.5 w
|
||||||
|
.960784 .960784 .862745 rg
|
||||||
|
n -6 -6 468.6898 72 re B*
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 50 Tm 12 TL /F3 10 Tf 0 0 0 rg (WHILE ) Tj (<) Tj (expr) Tj (>) Tj T* (DO) Tj T* ( ) Tj (<) Tj (statement) Tj (>) Tj T* ( {) Tj (<) Tj (statement) Tj (>) Tj (}) Tj T* (DONE) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 240.2236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Routines) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 210.2236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .012927 Tw (Because in sBasic variables are always global there is no need for functions. Instead Routines are used to) Tj T* 0 Tw (group code.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 168.2236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL 1.907045 Tw (Routines can be defined defined at any point of the code but the first statement. However when the) Tj T* 0 Tw 1.886412 Tw (program execution reaches a Routine this will result in a stack-underflow. The compiler will therefore) Tj T* 0 Tw (check that a routine cannot be reached without a call.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 138.2236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 14 Tm 2.499398 Tw 12 TL /F1 10 Tf 0 0 0 rg (Any routine must therefore not be the first statement and must follow either a ) Tj /F3 10 Tf 0 0 0 rg (CALL ) Tj /F1 10 Tf 0 0 0 rg (or the ) Tj /F3 10 Tf 0 0 0 rg (HALT) Tj T* 0 Tw /F1 10 Tf 0 0 0 rg (command.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 120.2236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (A routine is defined like this:) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
|
||||||
|
endstream
|
||||||
|
endobj
|
||||||
|
47 0 obj
|
||||||
|
<< /Length 4211 >>
|
||||||
|
stream
|
||||||
|
1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 703.8236 cm
|
||||||
|
q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 0 cm
|
||||||
|
q
|
||||||
|
1 0 0 1 6.6 6.6 cm
|
||||||
|
q
|
||||||
|
.662745 .662745 .662745 RG
|
||||||
|
.5 w
|
||||||
|
.960784 .960784 .862745 rg
|
||||||
|
n -6 -6 468.6898 60 re B*
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 38 Tm 12 TL /F3 10 Tf 0 0 0 rg (ROUTINE ) Tj (<) Tj (routine_name) Tj (>) Tj T* ( ) Tj (<) Tj (statement) Tj (>) Tj T* ( {) Tj (<) Tj (statement) Tj (>) Tj (}) Tj T* (END) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 683.8236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (The name of a Routine must follow the conventions for variable names.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 665.8236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Routines can be executed by calling them:) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 632.6236 cm
|
||||||
|
q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 0 cm
|
||||||
|
q
|
||||||
|
1 0 0 1 6.6 6.6 cm
|
||||||
|
q
|
||||||
|
.662745 .662745 .662745 RG
|
||||||
|
.5 w
|
||||||
|
.960784 .960784 .862745 rg
|
||||||
|
n -6 -6 468.6898 24 re B*
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (CALL ) Tj (<) Tj (routine_name) Tj (>) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 602.6236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Special Commands) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 584.6236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (There is one built-in special command:) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 551.4236 cm
|
||||||
|
q
|
||||||
|
q
|
||||||
|
1 0 0 1 0 0 cm
|
||||||
|
q
|
||||||
|
1 0 0 1 6.6 6.6 cm
|
||||||
|
q
|
||||||
|
.662745 .662745 .662745 RG
|
||||||
|
.5 w
|
||||||
|
.960784 .960784 .862745 rg
|
||||||
|
n -6 -6 468.6898 24 re B*
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F3 10 Tf 12 TL (STOP) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 531.4236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (that will cause the bytecode interpreter to halt.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 501.4236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Comments) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 471.4236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 14 Tm 1.311988 Tw 12 TL /F1 10 Tf 0 0 0 rg (Comments start with a ) Tj /F3 10 Tf 0 0 0 rg (# ) Tj /F1 10 Tf 0 0 0 rg (at the beginning of the line and span over the entire line. The ) Tj /F3 10 Tf 0 0 0 rg (# ) Tj /F1 10 Tf 0 0 0 rg (sign might) Tj T* 0 Tw (follow one \(or more\) blanks.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 441.4236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 3 Tm 18 TL /F2 15 Tf 0 0 0 rg (Strings) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 423.4236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (There are two types of strings in sBasic: single line strings and multi line strings.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 381.4236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 26 Tm .112619 Tw 12 TL /F1 10 Tf 0 0 0 rg (A single line string starts and ends with a ) Tj /F3 10 Tf 0 0 0 rg (" ) Tj /F1 10 Tf 0 0 0 rg (character and must not span over several lines. The following) Tj T* 0 Tw .368988 Tw (conventions for strings are used: ) Tj /F3 10 Tf 0 0 0 rg (` ) Tj /F1 10 Tf 0 0 0 rg (is treated as character ) Tj /F3 10 Tf 0 0 0 rg (`) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F3 10 Tf 0 0 0 rg (\\\\ ) Tj /F1 10 Tf 0 0 0 rg (is treated as a single ) Tj /F3 10 Tf 0 0 0 rg (\\) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F3 10 Tf 0 0 0 rg (\\n,r,t ) Tj /F1 10 Tf 0 0 0 rg (is the) Tj T* 0 Tw (newline, carriage return, tab character. Any other combination of ) Tj /F3 10 Tf 0 0 0 rg (\\ ) Tj /F1 10 Tf 0 0 0 rg (and a character is a syntax error.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 351.4236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 14 Tm 1.447209 Tw 12 TL /F1 10 Tf 0 0 0 rg (A multi line string starts and ends with a ) Tj /F3 10 Tf 0 0 0 rg (` ) Tj /F1 10 Tf 0 0 0 rg (character and can span over several lines. Every newline) Tj T* 0 Tw (character in the string will be treated as such. ) Tj /F3 10 Tf 0 0 0 rg (" ) Tj /F1 10 Tf 0 0 0 rg (is treated as character ) Tj /F3 10 Tf 0 0 0 rg (") Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 318.4236 cm
|
||||||
|
q
|
||||||
|
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (sBasic Application Extensions) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
q
|
||||||
|
1 0 0 1 62.69291 276.4236 cm
|
||||||
|
q
|
||||||
|
0 0 0 rg
|
||||||
|
BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL 2.557126 Tw (When it comes to real world applications the sBasic language should be extended with Application) Tj T* 0 Tw .21784 Tw (Specific Commands \(ASC\). Those provide a way to directly access the assembly language controlling the) Tj T* 0 Tw (bytecode interpreter.) Tj T* ET
|
||||||
|
Q
|
||||||
|
Q
|
||||||
|
|
||||||
|
endstream
|
||||||
|
endobj
|
||||||
|
48 0 obj
|
||||||
|
<< /Nums [ 0 49 0 R 1 50 0 R 2 51 0 R ] >>
|
||||||
|
endobj
|
||||||
|
49 0 obj
|
||||||
|
<< /S /D /St 1 >>
|
||||||
|
endobj
|
||||||
|
50 0 obj
|
||||||
|
<< /S /D /St 2 >>
|
||||||
|
endobj
|
||||||
|
51 0 obj
|
||||||
|
<< /S /D /St 3 >>
|
||||||
|
endobj
|
||||||
|
xref
|
||||||
|
0 52
|
||||||
|
0000000000 65535 f
|
||||||
|
0000000075 00000 n
|
||||||
|
0000000130 00000 n
|
||||||
|
0000000240 00000 n
|
||||||
|
0000000355 00000 n
|
||||||
|
0000000526 00000 n
|
||||||
|
0000000697 00000 n
|
||||||
|
0000000868 00000 n
|
||||||
|
0000001039 00000 n
|
||||||
|
0000001210 00000 n
|
||||||
|
0000001381 00000 n
|
||||||
|
0000001553 00000 n
|
||||||
|
0000001725 00000 n
|
||||||
|
0000001897 00000 n
|
||||||
|
0000002069 00000 n
|
||||||
|
0000002241 00000 n
|
||||||
|
0000002413 00000 n
|
||||||
|
0000002585 00000 n
|
||||||
|
0000002757 00000 n
|
||||||
|
0000002929 00000 n
|
||||||
|
0000003101 00000 n
|
||||||
|
0000003273 00000 n
|
||||||
|
0000003445 00000 n
|
||||||
|
0000003617 00000 n
|
||||||
|
0000003789 00000 n
|
||||||
|
0000003961 00000 n
|
||||||
|
0000004133 00000 n
|
||||||
|
0000004242 00000 n
|
||||||
|
0000004620 00000 n
|
||||||
|
0000004830 00000 n
|
||||||
|
0000005040 00000 n
|
||||||
|
0000005149 00000 n
|
||||||
|
0000005460 00000 n
|
||||||
|
0000005538 00000 n
|
||||||
|
0000005655 00000 n
|
||||||
|
0000005802 00000 n
|
||||||
|
0000005970 00000 n
|
||||||
|
0000006110 00000 n
|
||||||
|
0000006250 00000 n
|
||||||
|
0000006373 00000 n
|
||||||
|
0000006499 00000 n
|
||||||
|
0000006633 00000 n
|
||||||
|
0000006759 00000 n
|
||||||
|
0000006871 00000 n
|
||||||
|
0000007005 00000 n
|
||||||
|
0000007083 00000 n
|
||||||
|
0000013109 00000 n
|
||||||
|
0000017733 00000 n
|
||||||
|
0000022001 00000 n
|
||||||
|
0000022063 00000 n
|
||||||
|
0000022100 00000 n
|
||||||
|
0000022137 00000 n
|
||||||
|
trailer
|
||||||
|
<< /ID
|
||||||
|
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
|
||||||
|
[(\371\300\304\374\242&eY\373\323\021\356\241\033"\261) (\371\300\304\374\242&eY\373\323\021\356\241\033"\261)]
|
||||||
|
/Info 31 0 R /Root 30 0 R /Size 52 >>
|
||||||
|
startxref
|
||||||
|
22174
|
||||||
|
%%EOF
|
203
doc/sBasic.rst
Normal file
203
doc/sBasic.rst
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
sBasic -- yet another simple programming language
|
||||||
|
*************************************************
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
|
||||||
|
sBasic Usage
|
||||||
|
============
|
||||||
|
|
||||||
|
sBasic is designed for freely programmable embedded
|
||||||
|
applications that do not allow scripting languages like JS,
|
||||||
|
Lua or Python.
|
||||||
|
|
||||||
|
One should not write applications with it, in contrary it is
|
||||||
|
designed to write extensions for micro controller projects.
|
||||||
|
|
||||||
|
sBasic Language Specification
|
||||||
|
=============================
|
||||||
|
|
||||||
|
Whitespace
|
||||||
|
==========
|
||||||
|
|
||||||
|
The following whitespace characters will be converted to
|
||||||
|
a single blank (``0x20``): ``\t\r`` and multiple blanks.
|
||||||
|
|
||||||
|
The newline character (``\n``) is a special character
|
||||||
|
however multiple newline characters will be interpreted as
|
||||||
|
one.
|
||||||
|
|
||||||
|
A statement always ends with a newline character. Tokens are
|
||||||
|
separated by blanks.
|
||||||
|
|
||||||
|
Variables and Arithmetic Operations
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
Variables have data types. Usually they will be integers,
|
||||||
|
but there might be other application specific datatypes.
|
||||||
|
|
||||||
|
Variables have to be declared explicitly using the scheme::
|
||||||
|
|
||||||
|
<datatype> <variablename> '=' <value>
|
||||||
|
|
||||||
|
**Note** that variable names must start with an alphabetic
|
||||||
|
character. Variable names can contain after the first
|
||||||
|
character all of the following characters::
|
||||||
|
|
||||||
|
a..zA..Z0..9_
|
||||||
|
|
||||||
|
Datatype names must follow the same conventions as the
|
||||||
|
variable name convention.
|
||||||
|
|
||||||
|
**Note**: Variables are always global.
|
||||||
|
|
||||||
|
Here is an example for valid variable declarations::
|
||||||
|
|
||||||
|
int A = 2
|
||||||
|
int B = 3
|
||||||
|
int A_plus_B = 0
|
||||||
|
|
||||||
|
Arithmetic commands are application specific, for integer
|
||||||
|
usually ``+ - * /`` are defined. Arithmetic commands can be
|
||||||
|
grouped by using parenthesis ``()``.
|
||||||
|
|
||||||
|
``*`` and ``/`` will be executed before ``+`` and ``-``, the
|
||||||
|
inner of parenthesis will be executed before the outer and
|
||||||
|
by default commands will be executed in the order they
|
||||||
|
appear.
|
||||||
|
|
||||||
|
Conditional Statements
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
sBasic knows the if-else-structure::
|
||||||
|
|
||||||
|
IF <expr>
|
||||||
|
THEN
|
||||||
|
<statement>
|
||||||
|
{<statement>}
|
||||||
|
[ELSE
|
||||||
|
<statement>
|
||||||
|
{<statement>}]
|
||||||
|
FI
|
||||||
|
|
||||||
|
|
||||||
|
Loops
|
||||||
|
-----
|
||||||
|
|
||||||
|
sBasic knows the while-loop::
|
||||||
|
|
||||||
|
WHILE <expr>
|
||||||
|
DO
|
||||||
|
<statement>
|
||||||
|
{<statement>}
|
||||||
|
DONE
|
||||||
|
|
||||||
|
Routines
|
||||||
|
--------
|
||||||
|
|
||||||
|
Because in sBasic variables are always global there is no
|
||||||
|
need for functions. Instead Routines are used to group code.
|
||||||
|
|
||||||
|
Routines can be defined defined at any point of the code but
|
||||||
|
the first statement.
|
||||||
|
However when the program execution reaches a Routine this
|
||||||
|
will result in a stack-underflow. The compiler will
|
||||||
|
therefore check that a routine cannot be reached without
|
||||||
|
a call.
|
||||||
|
|
||||||
|
Any routine must therefore not be the first statement and
|
||||||
|
must follow either a ``CALL`` or the ``HALT`` command.
|
||||||
|
|
||||||
|
A routine is defined like this::
|
||||||
|
|
||||||
|
ROUTINE <routine_name>
|
||||||
|
<statement>
|
||||||
|
{<statement>}
|
||||||
|
END
|
||||||
|
|
||||||
|
The name of a Routine must follow the conventions for
|
||||||
|
variable names.
|
||||||
|
|
||||||
|
Routines can be executed by calling them::
|
||||||
|
|
||||||
|
CALL <routine_name>
|
||||||
|
|
||||||
|
Special Commands
|
||||||
|
----------------
|
||||||
|
|
||||||
|
There is one built-in special command::
|
||||||
|
|
||||||
|
STOP
|
||||||
|
|
||||||
|
that will cause the bytecode interpreter to halt.
|
||||||
|
|
||||||
|
Comments
|
||||||
|
--------
|
||||||
|
|
||||||
|
Comments start with a ``#`` at the beginning of the line and
|
||||||
|
span over the entire line. The ``#`` sign might follow one
|
||||||
|
(or more) blanks.
|
||||||
|
|
||||||
|
Strings
|
||||||
|
-------
|
||||||
|
|
||||||
|
There are two types of strings in sBasic: single line
|
||||||
|
strings and multi line strings.
|
||||||
|
|
||||||
|
A single line string starts and ends with a ``"`` character
|
||||||
|
and must not span over several lines. The following
|
||||||
|
conventions for strings are used: ````` is treated as
|
||||||
|
character `````, ``\\`` is treated as a single ``\``,
|
||||||
|
``\n,r,t`` is the newline, carriage return, tab character.
|
||||||
|
Any other combination of ``\`` and a character is a syntax
|
||||||
|
error.
|
||||||
|
|
||||||
|
A multi line string starts and ends with a ````` character
|
||||||
|
and can span over several lines. Every newline character in
|
||||||
|
the string will be treated as such. ``"`` is treated as
|
||||||
|
character ``"``.
|
||||||
|
The rest of the conventions follow the conventions for
|
||||||
|
single line strings.
|
||||||
|
|
||||||
|
**Note** that strings in sBasic are static and stored in the
|
||||||
|
program memory.
|
||||||
|
|
||||||
|
Datatypes
|
||||||
|
---------
|
||||||
|
|
||||||
|
- Strings are indicated by the ``str`` keyword. The variable
|
||||||
|
itself is a pointer to the actual string that will be
|
||||||
|
stored at the end of the program memory
|
||||||
|
- Integers are indicated by the ``int`` keyword.
|
||||||
|
- Characters are indicated by the ``chr`` keyword. Literal
|
||||||
|
characters are surrounded by two ``'`` characters. They
|
||||||
|
can contain escape sequences (``\ntr'``).
|
||||||
|
- Floats are not supported by vanilla sBasic. They should
|
||||||
|
however be marked using the ``flt`` or ``dbl`` keywords.
|
||||||
|
|
||||||
|
sBasic Application Extensions
|
||||||
|
=============================
|
||||||
|
|
||||||
|
When it comes to real world applications the sBasic language
|
||||||
|
should be extended with Application Specific Commands (ASC).
|
||||||
|
Those provide a way to directly access the assembly language
|
||||||
|
controlling the bytecode interpreter.
|
||||||
|
|
||||||
|
ASCs should typically compile to few assembly commands,
|
||||||
|
like::
|
||||||
|
|
||||||
|
# sBasic
|
||||||
|
string string_part = string + 1
|
||||||
|
PUTCREF string_part
|
||||||
|
|
||||||
|
; assembly
|
||||||
|
; string_part = string + 1
|
||||||
|
ld 0, string
|
||||||
|
ld 1, 1
|
||||||
|
add 0, 1
|
||||||
|
st 0, string_part
|
||||||
|
|
||||||
|
; PUTCREF string_part
|
||||||
|
ld 0, string_part
|
||||||
|
putcref 0
|
||||||
|
|
||||||
|
|
0
s_basic/__init__.py
Normal file
0
s_basic/__init__.py
Normal file
0
s_basic/code_segments/__init__.py
Normal file
0
s_basic/code_segments/__init__.py
Normal file
19
s_basic/code_segments/abc.py
Normal file
19
s_basic/code_segments/abc.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
"""
|
||||||
|
This module provides abstract code segment classes.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
|
class AbstractCodeSegment(ABC):
|
||||||
|
@abstractmethod
|
||||||
|
def parse(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AbstractNestingCodeSegment(AbstractCodeSegment):
|
||||||
|
@abstractmethod
|
||||||
|
def parse_children(self):
|
||||||
|
pass
|
||||||
|
@abstractmethod
|
||||||
|
def parse_child(self):
|
||||||
|
pass
|
12
s_basic/code_segments/statements.py
Normal file
12
s_basic/code_segments/statements.py
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
"""
|
||||||
|
This module provides statement classes.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from .abc import AbstractCodeSegment
|
||||||
|
|
||||||
|
class VariableDefinitionStatement(AbstractCodeSegment):
|
||||||
|
def __init__(self, parsing_context):
|
||||||
|
self.parsing_context = parsing_context
|
||||||
|
|
||||||
|
def parse(self):
|
||||||
|
|
0
s_basic/context/__init__.py
Normal file
0
s_basic/context/__init__.py
Normal file
56
s_basic/context/context.py
Normal file
56
s_basic/context/context.py
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
"""
|
||||||
|
This module provides the parsing context classes.
|
||||||
|
"""
|
||||||
|
from ..util import CharacterDevice
|
||||||
|
|
||||||
|
class ParsingContext(object):
|
||||||
|
def __init__(self, file_, static_context):
|
||||||
|
self._file = CharacterDevice(file_)
|
||||||
|
self._static = static_context
|
||||||
|
self._line = 0
|
||||||
|
self._column = 0
|
||||||
|
self._last_column = 0
|
||||||
|
|
||||||
|
def getc(self):
|
||||||
|
res = self._file.getc()
|
||||||
|
if(res == "\n"):
|
||||||
|
self._line += 1
|
||||||
|
self._last_column = self._column
|
||||||
|
self._column = 0
|
||||||
|
else:
|
||||||
|
self._column += 1
|
||||||
|
return res
|
||||||
|
def ungetc(self, c):
|
||||||
|
if(c == "\n"):
|
||||||
|
self._column = self._last_column
|
||||||
|
self._line -= 1
|
||||||
|
else:
|
||||||
|
self._column -= 1
|
||||||
|
return self._file.ungetc(c)
|
||||||
|
def ungets(self, s):
|
||||||
|
for c in s:
|
||||||
|
self.ungetc(c)
|
||||||
|
|
||||||
|
|
||||||
|
class StaticParsingContext(object):
|
||||||
|
def __init__(self, custom_kwd_code_segments, custom_ctx_code_segments):
|
||||||
|
self._kwd_code_segments = {
|
||||||
|
(["int", "str", "chr"], ["statement"]): "variable_definition_segment",
|
||||||
|
(["STOP"], ["statement"]): "stop_command_segment",
|
||||||
|
(["CALL"], ["statement"]): "routine_call_segment",
|
||||||
|
(["("], ["expression", "int"]): "arithmetic_segment",
|
||||||
|
(["ROUTINE"], ["statement"]): "routine_segment",
|
||||||
|
(["WHILE"], ["statement"]): "while_segment",
|
||||||
|
(["IF"], ["statement"]): "if_segment",
|
||||||
|
(["\"", "`"], ["expression", "str"]): "string_definition_segment",
|
||||||
|
(["'"], ["expression", "chr"]): "character_definition_segment"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
self._kwd_code_segments.update(custom_kwd_code_segments)
|
||||||
|
|
||||||
|
self._ctx_code_segments = {
|
||||||
|
["statement"]: "assignment_segment",
|
||||||
|
["expression", "int"]: "arithmetic_segment",
|
||||||
|
|
||||||
|
|
0
s_basic/util/__init__.py
Normal file
0
s_basic/util/__init__.py
Normal file
18
s_basic/util/io.py
Normal file
18
s_basic/util/io.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
"""
|
||||||
|
This module provides utility functions and classed for I/O.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class CharacterDevice(object):
|
||||||
|
def __init__(self, file_):
|
||||||
|
self._file = file_
|
||||||
|
|
||||||
|
def getc(self):
|
||||||
|
return self._file.read(1)
|
||||||
|
def ungetc(self, c):
|
||||||
|
self._file.seek(-1, 1)
|
||||||
|
def ungets(self, s):
|
||||||
|
self._file.seel(-len(s), 1)
|
||||||
|
def close(self):
|
||||||
|
return self._file.close()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user