diff --git a/samples/000_Overview.noja b/samples/000_Overview.noja index a5d21a6..27d6473 100644 --- a/samples/000_Overview.noja +++ b/samples/000_Overview.noja @@ -2,13 +2,12 @@ # ------------------------------------------------------------------------- # # --- Introduction -------------------------------------------------------- # # -# This language was written as a personal study of how interpreters -# and compilers work. For this reason, the language is very basic and -# not innovative. -# One of the main inspirations was the CPython's source code since -# it's extremely readable and has a very simple clean architecture. +# This language was written as a personal study of how interpreters +# and compilers work. For this reason, the language is very basic. +# One of the main inspirations was the CPython's source code since +# 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 # need to be introduced to basic programming concepts (variables, # expressions and branches). This way, there is more space for the @@ -17,17 +16,17 @@ # ------------------------------------------------------------------------- # # --- Implementation ------------------------------------------------------ # # -# The interpreter works by compiling the provided source to a bytecode +# The interpreter works by compiling the provided source to a bytecode # format and executing it. The bytecode is very high level since it # does things like: # -# - explicitly referring to variables by name. +# - explicitly referring to variables by name. # -# - treating values as atomic things: from the perspective of the -# bytecode, a list and an integer occupy the same space on the +# - treating values as atomic things: from the perspective of the +# bytecode, a list and an integer occupy the same space on the # stack, which is 1. # -# - referring to instructions by their index. +# - referring to instructions by their index. # # For example, by compiling the following snippet @@ -41,18 +40,18 @@ print(a, '\n'); # one would obtain the following bytecode: # # 0: PUSHTRU -# 1: ASS [define] -# 2: POP 1 -# 3: PUSHVAR [define] +# 1: ASS "define" +# 2: POP 1 +# 3: PUSHVAR "define" # 4: JUMPIFNOTANDPOP 8 # 5: PUSHINT 33 -# 6: ASS [a] -# 7: POP 1 -# 8: PUSHSTR [\n] -# 9: PUSHVAR [a] -# 10: PUSHVAR [print] -# 11: CALL 2 -# 12: POP 1 +# 6: ASS "a" +# 7: POP 1 +# 8: PUSHSTR "\n" +# 9: PUSHVAR "a" +# 10: PUSHVAR "print" +# 11: CALL 2 +# 12: POP 1 # 13: RETURN # # as you can see, there are instructions like ASS and PUSHVAR that @@ -60,7 +59,7 @@ print(a, '\n'); # that refer to other points of the "executable" by specifying indices # (like JUMPIFNOTANDPOP) instead of raw addresses. # -# All values (objects) are allocated on a garbage-collected heap. +# All values (objects) are allocated on a garbage-collected heap. # For this reason all variables are simply references to these objects. # The garbage collection algorithm is a copy-and-compact one. It # behaves as a bump-pointer allocator until there is space left, diff --git a/samples/100_Expressions.noja b/samples/100_Expressions.noja index 7ecc965..139cb7f 100644 --- a/samples/100_Expressions.noja +++ b/samples/100_Expressions.noja @@ -93,6 +93,20 @@ print(6 != 6, '\n'); # false # The equal and not equal operators are available on every type of object, # while the others are only available for numeric types. +# +# ------------------------------------------------------------------------- # +# --- The boolean type ---------------------------------------------------- # +# + +# TODO + +# +# ------------------------------------------------------------------------- # +# --- The none value ------------------------------------------------------ # +# + +# TODO + # # ------------------------------------------------------------------------- # # ------------------------------------------------------------------------- # diff --git a/samples/150_Branches.noja b/samples/150_Branches.noja index 50d5ca0..d6c1935 100644 --- a/samples/150_Branches.noja +++ b/samples/150_Branches.noja @@ -43,8 +43,8 @@ a = 1; if a < 2: x = 100; -# Now x is defined, but is a were to be higher or equal to 2, it wouldn't -# be defined and the runtime would return an error. +# Now x is defined, but if "a" were to be higher or equal to 2, it +# wouldn't be defined and the runtime would return an error. # # ------------------------------------------------------------------------- # # ------------------------------------------------------------------------- # diff --git a/samples/250_Functions.noja b/samples/250_Functions.noja index 875a053..b1eb051 100644 --- a/samples/250_Functions.noja +++ b/samples/250_Functions.noja @@ -54,6 +54,7 @@ test_func = 5; # test_func(); +# # ------------------------------------------------------------------------- # # --- Returns ------------------------------------------------------------- # # @@ -68,6 +69,7 @@ r = multiply(p, q); print(p, ' * ', q, ' = ', r, '\n'); +# # ------------------------------------------------------------------------- # # --- Scopes -------------------------------------------------------------- # # @@ -80,8 +82,8 @@ print(p, ' * ', q, ' = ', r, '\n'); # 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 # 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.. print = 5;