Update README

This commit is contained in:
Alex Bethel 2022-08-10 13:17:16 -05:00
parent 1f7fcf9fb1
commit dcab42d0b3

View file

@ -9,10 +9,9 @@ is formatted correctly! ~~abb
# AlexScript # AlexScript
AlexScript (which is a misnomer; the language will soon be renamed AlexScript is a programming language designed to have the very
since it's not actually a scripting language) is a programming high-level ergonomics and provable correctness of a purely functional
language designed to have a functional feel and very high-level language, while maintaining speed using strictly-controlled,
ergonomics while maintaining speed using strictly-controlled,
deterministic memory management. The language is capable of compiling deterministic memory management. The language is capable of compiling
to C (and possibly other languages in the future), allowing for to C (and possibly other languages in the future), allowing for
maximum portability without having to write a new backend for the maximum portability without having to write a new backend for the
@ -20,25 +19,32 @@ compiler for every possible target; also, the compiler and tooling
will eventually be rewritten in AlexScript to allow for maximum will eventually be rewritten in AlexScript to allow for maximum
portability. portability.
Syntactically, the language primarily resembles a mixture between
standard ML and Rust; the language always ignores whitespace.
AlexScript is a misnomer; the language is not actually a scripting
language and will probably be renamed in the near future.
## Example ## Example
``` ```
// Calculates the nth fibonacci number. // Calculates the nth fibonacci number.
def fibonacci (0: U32) : U32 = 0 def fibonacci (n: U32) : U32 = match n {
| fibonacci 1 = 1 0 => 0,
| fibonacci n = fibonacci (n - 2) + fibonacci (n - 1); 1 => 1,
n => fibonacci (n - 2) + fibonacci (n - 1),
};
// Prompts the user for a number n, and prints the Fibonacci numbers up // Prompts the user for a number n, and prints the Fibonacci numbers up
// to n. // to n.
def fibPrompt def fibPrompt = do {
= do {
print "Enter a number: "; print "Enter a number: ";
num <- read <$> getLine; num <- read <$> getLine;
sequence_ (print . fibonacci <$> (0 .. num)); sequence_ (print . fibonacci <$> (0 .. num));
}; };
// Program entry point. // Program entry point.
def main: IO () def main : IO ()
= fibPrompt; = fibPrompt;
``` ```
@ -49,12 +55,17 @@ Note that type annotations are always optional; here they're given for
## Tools ## Tools
This repository contains the following tools: This repository contains the following tools:
- `axc`, the AlexScript compiler. This can be used as a binary with a - `axc-rs`, the Stage-1 AlexScript compiler, written in Rust. This can
fairly standard compiler CLI, or as a library for use in other be used as a binary with a fairly standard compiler CLI, or as a
programs. library for use in other Rust programs.
The following tools do not exist yet, but are planned: The following tools do not exist yet, but are planned:
- `axci`, the interactive AlexScript interpreter. - `axc`, the main AlexScript compiler written in AlexScript. This
program supports a superset of the behavior of `axc-rs`, and exposes
a library that can be used by other AlexScript programs in addition
to a the compiler CLI.
- `axci`, the interactive AlexScript interpreter, a wrapper around
`axc`.
- `axcd`, the Language Server Protocol (LSP) server for AlexScript - `axcd`, the Language Server Protocol (LSP) server for AlexScript
code support in editors, supporting definition peeking and lookup, code support in editors, supporting definition peeking and lookup,
renaming variables and modules, etc. renaming variables and modules, etc.