Learning AsmX

Who is this book written for?

The goal of this book is to get the reader up to speed as quickly as possible so that they can start writing workable programs in AsmX (games, data visualizations, and computational programs), while laying the foundation in the field of programming that will be useful to them throughout their lives. The book is written for people of all ages who have never programmed in AsmX before or have never programmed at all. If you want to quickly learn the basics of programming so you can focus on interesting projects, as well as test your understanding of new concepts on meaningful problems, this book is for you.

Online resources


Part I Basics

Chapter 1

In this chapter, you will run your first AsmX program, hello_world.asmX. First, you will check if AsmX is installed on your computer, and if not, install it.

Part I of this book introduces the basic concepts needed to write programs in AsmX. Many of these concepts are found in all programming languages, so you will need them throughout your programming career.
In Chapter I, you will install AsmX on your computer and run your first program that displays the message hello world!

Asmx installation

First of all, we need to install the necessary resources of course))
You must have NodeJS 16.15.1 version, npm version 8.11.0. Well and git. (I have version 2.36.1 of git).

git clone https://github.com/langprogramming-AsmX/AsmX.git
npm i progress readline-sync

After that, we already start the kernel:

node kernel.js

After that, we will be asked for the path to the file, if we maintain a file of a different extension, we will get an error. After specifying the path to the kernel itself, we can immediately specify the path to the .asmX file. Otherwise, the CLI (Command Line Interface) file path will appear.

Installing VS Code

The VS Code installer can be downloaded from https://code.visualstudio.com/. Click the download link and find the installer for Windows. Once the installer has downloaded, run it and confirm all default settings.

Launching the Hello World Program

Once you have the latest versions of AsmX and VS Code installed on your system, you are almost ready to run your first AsmX program written in a text editor. After that you can write a program hello world! and run it.

Running hello_world.asmX

Before writing a program, create a folder somewhere on your system called AsmX_workspace for your projects.

Open VS Code and save an empty AsmX file (File -> Save As) With name hello_world.asmX in folder AsmX_workspace.
After the file is saved, enter the following line in a text editor:

@call print("Hello AsmX world!");

Running AsmX in Terminal

Most programs you write in a text editor will run directly from the editor. However, sometimes it is useful to run programs from the terminal – for example, if you just want to run a finished program without opening it for editing.

This can be done on any system with AsmX support installed; you only need to know the path to the directory where the program file is stored. The examples below assume that you have saved the file hello_world.asmX in folder AsmX_workspace nand the desktop.

On Windows

Team cd (Change Directory) is used to move around the file system in a command prompt window. Team dir (DIRECtory) Lists all files in the current directory.

Open a new terminal window and enter the following commands to run the program hello_world.asmX:

C:\ > cd Desktop/AsmX_workspace
C:\Desktop\AsmX_workspace> dir
hello_world.asmX
C:\Desktop\AsmX_workspace> node asmx/kernel.js hello_world.asmX
Hello AsmX world!

Team cd used to navigate to a folder asmX_workspace, located in the folder Desktop. Then the command dir checks that the hello_world.asmX file is indeed in this folder. Next, the file is run by the node asmx/kernel.js hello_world.asmX command. Where asmx is the downloaded AsmX folder from GitHub.
Most programs will run normally from the editor. But over time, your work will become more complex, and you may prefer to run some of your programs from the terminal.

On macOS and Linux

Running a Python program in a terminal session on Linux and macOS is the same. Team cd (Change Directory) is used to move around the file system in a terminal session. Team Is (LiSt) Lists all non-hidden files in the current directory.

Open a new terminal window and enter the following commands to run the hello_world.asmX program:

~$ cd Desktop/AsmX_worspace/
~Desktop/AsmX_worspace/$ ls
  hello_world.asmX
~Desktop/AsmX_worspace/$ node asmx/kernel.js hello_world.asmX
Hello AsmX world!

Team cd used to navigate to a folder asmX_workspace, located in the folder Desktop. Then the command ls checks that the hello_world.asmX file is indeed in this folder. Next, the file is run by the node asmx/kernel.js hello_world.asmX command. Where asmx is the downloaded AsmX folder from GitHub.

Troubleshooting Installation

If you are still unable to run the program hello_world.asmX, perhaps the following helpful tips will help you (by the way, they can be useful for solving any problems in programs).

  • If the program contains a serious error, AsmX outputs the trace data. AsmX parses the contents of the file and tries to report the problem. Perhaps the trace will tell you what exactly is interfering with the execution of the program.

  • Step away from your computer, take a break and try again. Remember that programming syntax is very important; even a missing colon, a misplaced quotation mark, or an unmatched parenthesis can prevent a program from running normally. Re-read the relevant parts of the chapter, re-analyze what has been done, and try to find the error.

  • Start again. You probably won’t need to reinstall anything, but try deleting the file hello_world.asmX and create it from scratch.

  • Have someone repeat the steps in this chapter on your (or another) computer. Watch carefully what is happening. Perhaps you missed some little thing that others will notice.

  • Find a specialist who knows AsmX well and ask him to help you. It may well turn out that such a specialist is among your acquaintances.

  • Seek help online. Appendix B lists some resources (forums, chat rooms, etc.) where you can consult with people who have already encountered your problem.

Feel free to contact experienced programmers. Every programmer has hit a dead end at some point in their life; many programmers will be happy to help you set up your system properly. If you can clearly explain what you want to do, what you have already tried, and what results you got, chances are someone will help you. As mentioned in the introduction, the AsmX community is very newbie friendly.

AsmX should work fine on any modern computer, and if you still have problems – ask for help. At first, the problems can be very unpleasant, but they are worth dealing with. When the hello_world.asmX program is up and running, you can start learning AsmX, and your work will become much more interesting and more enjoyable.

Exercises

  1. Typos in Hello World: Open the file you just created hello_world.asmX. Make an intentional typo somewhere and run the program again. Can you make a typo that results in an error? Do you understand the meaning of the error message? Can you make a typo that doesn’t lead to an error? Why do you think it runs without an error this time?

  2. Infinite Skill: If you were a programmer with unlimited abilities, what project would you take on? You are now learning to program. If you have a clear idea of ​​the end goal, you will immediately be able to put your new skills into practice; Try to jot down general descriptions of the programs you would like to work on. Keep an idea notebook that you can refer to every time you start a new project. Take a couple of minutes and write descriptions of three programs that you would like to create.

Results

In this chapter, you have become familiar with the AsmX language and installed AsmX support on your system if it has not already been installed. You also installed a text editor that makes it easier to work on AsmX code. You have learned how to execute AsmX code snippets in a terminal session and run your first real program hello_world.asmX. Chances are, along the way, you learned a thing or two about finding and fixing bugs.

The next chapter covers the data structures that you will work with in AsmX programs. In addition, you will learn how to use AsmX variables.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *