worked on docs

This commit is contained in:
Francesco Cozzuto
2021-11-05 01:35:32 +01:00
parent fe6f6b5039
commit 1769ffc995
4 changed files with 41 additions and 26 deletions
+8 -9
View File
@@ -3,10 +3,9 @@
# --- Introduction -------------------------------------------------------- # # --- Introduction -------------------------------------------------------- #
# #
# This language was written as a personal study of how interpreters # This language was written as a personal study of how interpreters
# and compilers work. For this reason, the language is very basic and # and compilers work. For this reason, the language is very basic.
# not innovative.
# One of the main inspirations was the CPython's source code since # One of the main inspirations was the CPython's source code since
# it's extremely readable and has a very simple clean architecture. # it's extremely readable and has a very simple and clean architecture.
# #
# This file was intended for people who already program in other # This file was intended for people who already program in other
# high level languages (such as Python, Javascript, Ruby) and don't # high level languages (such as Python, Javascript, Ruby) and don't
@@ -41,16 +40,16 @@ print(a, '\n');
# one would obtain the following bytecode: # one would obtain the following bytecode:
# #
# 0: PUSHTRU # 0: PUSHTRU
# 1: ASS [define] # 1: ASS "define"
# 2: POP 1 # 2: POP 1
# 3: PUSHVAR [define] # 3: PUSHVAR "define"
# 4: JUMPIFNOTANDPOP 8 # 4: JUMPIFNOTANDPOP 8
# 5: PUSHINT 33 # 5: PUSHINT 33
# 6: ASS [a] # 6: ASS "a"
# 7: POP 1 # 7: POP 1
# 8: PUSHSTR [\n] # 8: PUSHSTR "\n"
# 9: PUSHVAR [a] # 9: PUSHVAR "a"
# 10: PUSHVAR [print] # 10: PUSHVAR "print"
# 11: CALL 2 # 11: CALL 2
# 12: POP 1 # 12: POP 1
# 13: RETURN # 13: RETURN
+14
View File
@@ -93,6 +93,20 @@ print(6 != 6, '\n'); # false
# The equal and not equal operators are available on every type of object, # The equal and not equal operators are available on every type of object,
# while the others are only available for numeric types. # while the others are only available for numeric types.
#
# ------------------------------------------------------------------------- #
# --- The boolean type ---------------------------------------------------- #
#
# TODO
#
# ------------------------------------------------------------------------- #
# --- The none value ------------------------------------------------------ #
#
# TODO
# #
# ------------------------------------------------------------------------- # # ------------------------------------------------------------------------- #
# ------------------------------------------------------------------------- # # ------------------------------------------------------------------------- #
+2 -2
View File
@@ -43,8 +43,8 @@ a = 1;
if a < 2: if a < 2:
x = 100; x = 100;
# Now x is defined, but is a were to be higher or equal to 2, it wouldn't # Now x is defined, but if "a" were to be higher or equal to 2, it
# be defined and the runtime would return an error. # wouldn't be defined and the runtime would return an error.
# #
# ------------------------------------------------------------------------- # # ------------------------------------------------------------------------- #
# ------------------------------------------------------------------------- # # ------------------------------------------------------------------------- #
+4 -2
View File
@@ -54,6 +54,7 @@ test_func = 5;
# test_func(); # test_func();
#
# ------------------------------------------------------------------------- # # ------------------------------------------------------------------------- #
# --- Returns ------------------------------------------------------------- # # --- Returns ------------------------------------------------------------- #
# #
@@ -68,6 +69,7 @@ r = multiply(p, q);
print(p, ' * ', q, ' = ', r, '\n'); print(p, ' * ', q, ' = ', r, '\n');
#
# ------------------------------------------------------------------------- # # ------------------------------------------------------------------------- #
# --- Scopes -------------------------------------------------------------- # # --- Scopes -------------------------------------------------------------- #
# #
@@ -80,8 +82,8 @@ print(p, ' * ', q, ' = ', r, '\n');
# The only exception is made for the "built in" variables, which are # The only exception is made for the "built in" variables, which are
# provided by the runtime of the language and can't be modified by the # provided by the runtime of the language and can't be modified by the
# user. The print function is one of these variables. One may override # user. The print function is one of these variables. One may override
# these variables but the effect only lasts for the local context. # these variables but the effect only lasts for the lifetame of the
# # context local to the assignment.
# Overwrite the print variable inside the global scope.. # Overwrite the print variable inside the global scope..
print = 5; print = 5;