You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: FAST.FBasicInterpreter/Documents/FBasicManual.md
+52-21Lines changed: 52 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,18 +11,17 @@ In this manual you can find the following chapters
11
11
3. Statements
12
12
4. Debugging
13
13
5. Comments
14
-
6. Functions
15
-
7. Variables
16
-
8. Collections
17
-
9. Operators
18
-
10. Libraries and Add-Ons
19
-
1\. String functions
20
-
21
-
2\. Mathimatical functions
22
-
23
-
3\. SQL Data provider
24
-
25
-
11. Handlers
14
+
6. Datatypes
15
+
7. Functions
16
+
8. Variables
17
+
9. Collections
18
+
10. Operators
19
+
11. Libraries and Add-Ons
20
+
1\. String functions
21
+
2\. Mathematical functions
22
+
3\. Date and Time functions
23
+
4\. SQL Data provider
24
+
12. Handlers
26
25
27
26
### Flow Control
28
27
@@ -167,6 +166,19 @@ _example:_
167
166
> let a=10 ' set the value 10 to variable a
168
167
> ```
169
168
169
+
### Datatypes
170
+
171
+
FBASIC, as programming language, typically offers two primary data types: **String** and **Real**.
172
+
173
+
* A **String** is a sequence of characters, such as letters, numbers, or symbols, enclosed in double quotes. It's used for handling text.
174
+
* A **Real** (also known as a floating-point number) represents a number with a fractional component. It's used for all numerical calculations, from simple arithmetic to complex equations.
175
+
176
+
In FBASIC interpreter, other data types like **Integer**, **Boolean**, **Date**, and **Time** are not natively supported. The FBASIC simulate these by using the existing **Real** and **String** types and applying specific conventions or libraries to manage them. For instance, integers are stored as **Real** numbers, and logical values (true/false) can be represented by numeric value. This simplifies the language while still allowing for a wide range of programming tasks.
177
+
178
+
Especially for **Date** and **Time** datatypes check this manual at libraries chapter (Date & Time libraries).
179
+
180
+
About the Boolean values there a need to explain further the concept. In most of the BASIC implementations, **0 is false** and **\-1 is true**. Why this? In most modern programming languages, the integer 0 represents **false**, and any non-zero integer represents **true**. However, in early versions of BASIC, a different convention was adopted. This was due to the way logical operations were implemented at the machine-code level. The bitwise operations for _AND_, _OR_, and _NOT_ were often optimized to work with all the bits of a value. A bitwise _NOT_ of 00000000 (which is 0 in a byte) results in 11111111, which is -1 in two's complement representation. This made it convenient to use -1 for true, as it was the direct result of a _NOT_ operation on the false value (0).
181
+
170
182
### Functions
171
183
172
184
#### Built-ins functions:
@@ -221,7 +233,28 @@ FBASIC, includes a variety of built-in mathematical functions to perform commo
221
233
222
234
as the FBASIC does not support constants, a constant is a variable with a value. Its up to the programmer to avoid to modify that value.
223
235
224
-
* **PI:** The PI value, approximately equal to 3.14159.
236
+
* **PI:** The PI value, approximately equal to 3.14159.
237
+
238
+
#### Date & Time Functions
239
+
240
+
Date and Time functions in the BASIC programming language are used to handle and manipulate dates and times. These functions allow programs to retrieve the current date and time, perform calculations with dates, and format dates for display or any other usage. The native date format is the DD-MM-YYYY. As the FBASIC does not support date as datatype, the functions will consider any valid value having this format as a date.
241
+
242
+
Date and Time functions listed here are available if library _FBasicDateFunctions_ is enabled.
243
+
244
+
* **date():** This function returns a string representing the current system date. The format typically includes the day, month, and year.
245
+
* **isdate(d)**: Check if the input string is a valid date.
246
+
* **day():** Extract the day as an numeric value (integer) from a date variable. For example, day("26-10-2025") would return 26.
247
+
* **month():** Extract the month as an numeric value (integer) from a date variable. For example, month("26-10-2025") would return 10.
248
+
* **year():** Extract the year as an numeric value (integer) from a date variable. For example, year("26-10-2025") would return 2025.
249
+
* **jtod():** Converts the japan style of date (YYYY-MM-DD) to International (DD-MM-YYYY). For example, JTOD("2025-10-26") would return “26-10-2025”.
250
+
* **dtoj():** Converts the International (DD-MM-YYYY) date to japan style of date (YYYY-MM-DD).
251
+
252
+
The native time format is the HH:MM:SS.FFF. As the FBASIC does not support date or time as datatype, the functions will consider any valid value having this format as a time. Also the functions will consider valid a time of the formats: HH:MM:SS, HH:MM, and the HH:MM:SS.FFF, HH:MM:SS.FF and HH:MM:SS.F
253
+
254
+
* **time():** This function returns a string representing the current system time. The format is usually HH:MM:SS.
255
+
* **hour():** extracts the hours as an integer from a time variable.
256
+
* **minute():** extracts the minutes as an integer from a time variable.
257
+
* **second():** extracts the seconds as an integer from a time variable.
Libraries are add-ons to the main FBASIC Interpreter that provide **functions**, **statements**, and **variables** (or **constants**). You can only enable a library during the interpreter's initialization, before you run the FBASIC program. Implementing a library is incredibly easy; refer to the how-to manual for more information.
322
355
323
-
**Strings Library**
324
-
325
-
The name of this library is: _FBasicStringFunctions_ and for further information see the _Functions_ section of this document.
326
-
327
-
**Mathimatical Library**
328
-
329
-
The name of this library is: _FBasicMathFunctions_ and for further information see the _Functions_ section of this document.
356
+
***Buildins Libray:** contains the very basic functions are available to the FBASIC programing language, without the need to enable it. There is switch that the developer can disable that code.
357
+
***Buildins Collections Library:** contains the very basic functions and statements for collections manipulation. It is enabled by default but the developer can disable that code.
358
+
***Strings Library:** The name of this library is: _FBasicStringFunctions_ and for further information see the _Functions_ section of this document.
359
+
***Mathematical Library:** The name of this library is: _FBasicMathFunctions_ and for further information see the _Functions_ section of this document.
360
+
***Date and Time Library:** The name of this library is: _FBasicDateFunctions_ and for further information see the _Functions_ section of this document.
330
361
331
362
### SQL Data Provider
332
363
@@ -429,4 +460,4 @@ To get the connection string, make a request to the “Request For Object” han
429
460
430
461
Notes:
431
462
432
-
> The editor of this file is: https://onlinemarkdowneditor.dev/
463
+
> The editor of this file is: https://onlinemarkdowneditor.dev/
0 commit comments