Debian Codegraph @

doc/Tutorial_1.sor

raw
1 # Soros Tutorial – Part One πŸ”’ Three, Two, One...
2 #
3 # INTRODUCTION
4 #
5 # Soros programming language is for number to
6 # number name conversion. It’s based on regular
7 # expressions, the popular text processing
8 # tool of modern programming languages. So if you
9 # don’t want to convert numbers to number names,
10 # it’s still worth to check this tutorial, because
11 # most parts are about regular expressions,
12 # giving useful information for modern C++, Java,
13 # JavaScript, Python etc. programming, too.
14 # If you know regular expressions well, you can
15 # jump to the last part of the tutorial!
16 #
17 # In this part, we will learn the base syntax of
18 # Soros, writing small programs to convert
19 # input numbers to numbers and colorful (at least
20 # in Mozilla Firefox) emojis!
21 #
22 #
23 #
24 # TASK 1 – HELLO, WORLD!
25 #
26 # A Soros program consists of program lines.
27 #
28 # A program line is an input text and an output text
29 # separated by (the first) space:
30 #
31 # input_text output text
32 #
33 # Following program line replaces the input text β€œ0”
34 # with the output text β€œHello, 🌍!”, as you can see
35 # in the right output list window, which shows the
36 # output of the first 120 integer numbers, including
37 # this one:
38
39 0 Hello, 🌍!
40
41 # Replace β€œHello, 🌍!” with β€œzero” in the previous line,
42 # and check the same change in the right output window
43 # list!
44 #
45 # Write here a new program line to convert the input
46 # text β€œ1” to β€œone”!
47
48
49
50 # TASK 2 – The early bird catches the worm.
51 #
52 # First matching program line gives result.
53 #
54 # Remove the line with the bird COMPLETELY, and
55 # then the line with the worm! During these, check
56 # the results in the right output list window!
57
58 2 🐦
59 2 πŸ›
60 2 two
61
62
63
64 # TASK 3 – Three blind mice
65 #
66 # Input text without matching program line, or a
67 # matching program line without output text
68 # results empty output text.
69 #
70 # Remove the character # (sign of comment line)
71 # before 3 in the following line to hide the mice!
72
73 #3
74 3 🐁🐁🐁
75
76
77
78 # TASK 4 – Five little speckled frogs
79 #
80 # Modify the following program lines to get correct
81 # number of frogs for the input number 5 and 4!
82
83 5 🐸🐸🐸🐸🐸🐸
84 4 🐸🐸🐸🐸🐸🐸
85
86 SCROLL DOWN FOR SOLUTION
87 ⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108 # Solution – TASK 4
109 #
110 # 5 🐸🐸🐸🐸🐸
111 # 4 🐸🐸🐸🐸
112
113
114 ######################################################
115 # CONGRATULATIONS – You have finished Tutorial One! πŸ™‚
116 ######################################################