ASTLang

From Esolang
Jump to navigation Jump to search

ASTLang is a coding language based off of the style of a abstract syntax tree. It uses a fully Python intepreter which is about 31kb in size (at the current release). More information is at the github page, including information about new updates, bugs, and fixed bugs. It is a turing complete esolang that can actually be learnt and used, with very simple syntax and similar to Python.

Note that this coding language was completely a "for fun" project and is not expected to be actually professionally used (I mean, who uses an esolang efficiently?)

How to get started

Obviously, from the description, the ASTLang interpreter and runtime environment needs at least Python 3 or preferably Python 3.12+ from best performance. All other packages like re or pickle will come pre-installed along with Python, so there is no need to go to other websites to find modules to run this program. As said, the main file is about 31kb large with 4100 lines of code (at the current moment, this will change). Head to the official page of Python to download it if you do not already have Python installed.

Code Structure

When starting any program, you must wrap all code inside the Module function. If the program is consists of only one function, it is not necessary to wrap it.

Module(
  ...
)

All code must go inside the braces (yes I know they are parenthesis but I cannot spell the word "parenthesis" quickly and correctly consistently so bare with me). After that, all functions inside the Module function should be separated by commas, except for the last one which can be ignored if the programmer wishes.

Module(
  foo(),
  foobar(),
  foobarbar()
)

Inside a function, if a function does need to take arguments, they should also be seperated by commas, except for the last one which is optional. The programmer may also choose optionally to name all arguments, but they should do this consistently or it will cause confusion, and sometimes unexpected errors. This means that if a programmer names one argument, they should name all of them.

 foo(
 Blah=BlahBlah,
 BlahBlah=Blah123
 Blah4321=BlahBlahBlah
 )

Sometimes, an argument may need a list (an argument with brackets surrounding it) input. To define it, separate all elements inside it, except for the last one optionally (I am saying this a lot!).

 Blah = [1, 2, 3, 4]

How To Save

If you wish to save a file, press Crtl+S to save the file. This will save it as a binary file, with the file extension .astlang. Unfortunately, this file can be unexpectedly large and take up storage. A general idea is to save it as a plain text file, then copy+paste it into the IDE. This can save up to 10x the storage. To open a file, press Crtl+O. A file explorer window will automatically popup, and you must select a file with .astlang. This will open all file contents inside the file.

Print

To print a variable or anything, use FuncCall. This is a wrapper function used to call simple functions like Min, Max, Len and Print.

FuncCall(
Function=Print(
  Contents=Foo
  End=Foo
)

Contents is what is to be printed. End is what should be added at the end. This is default to a newline. Note that you should use a identifier, not just a plain type. For example, if you just put a string in Contents without String, it may not produce the desired output.

Create A Variable