Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/patrickgh3/jai-getting-started


https://github.com/patrickgh3/jai-getting-started

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

        

This document has tips for getting started using the language in its current beta version,
that aren't currently covered in the official distributed documentation.
The distributed README.txt and the core programs in the how_to/ folder should be read first!

Also check out the [Jai-Community-Library wiki](https://github.com/Jai-Community/Jai-Community-Library/wiki).

Last updated 2021-10-21

# Getting started info

## Navigating and finding functionality

* Read the names of all the included modules in the distributed modules/ folder,
to get a sense of what's available.

* Check out this [Jai Awesome List](https://github.com/Jai-Community/awesome-jai)
which has community-made modules.

* Using grep-like tools to search the distributed code is a useful and common way to "get around"
and find what you're looking for in the language. Some examples:

* If I want to find where the string-related functions are, I might search for "string_".
* If I want to find some example usage of a certain module, function, or keyword, I might search for "#import "Module\_Name"" or "function\_name" or "keyword".
* If I want to find the definition of a function, I might search for "function_name ::".

* These are some grep-like tools:

* [ripgrep (Windows, Mac, Linux)](https://github.com/BurntSushi/ripgrep)
* [BareGrep (Windows)](https://www.baremetalsoft.com/baregrep)

* These are modules I recommend looking at when starting out:

* Basic
* String
* Hash_Table
* Math
* File
* Compiler

## Directory organization and custom modules

You can organize your directories however you like. One format some people use is:

jai/
jai/ - The distributed compiler folder. For compiler updates, just replace this folder.
bin/
examples/
...
jai_modules/ - Downloaded modules and your own modules. Use the compiler's -import_dir command line flag for it to find your custom modules folder.
my_project_1/
my_project_2/
...

## Debugging

You can use a debugger with an exe and the generated .pdb file.
For example, in Visual Studio, open the .exe file using File -> Open -> Projects/Solution, and you can set breakpoints and run.

## Crashes

If your program crashes, as of the time of this writing, the program will stop
and nothing will be printed out. This can be confusing!
You can use the Debug module to print the stack trace on crashes:

Debug :: #import "Debug";

main :: () {
Debug.init();

a := 0;
b := 1 / a; // Cause a crash

write_string("done\n"); // The execution will not reach this point
}

## Pointer operators

a: int;
b: *int = *a; // address-of
c: int = <