reorganized readme

This commit is contained in:
cozis
2022-03-27 17:12:30 +02:00
parent 9aedb9e109
commit cb6e88a448
2 changed files with 17 additions and 7 deletions
+17 -7
View File
@@ -1,4 +1,13 @@
# The Noja language # The Noja language
1. [Introduction](#introduction)
1. [Objective](#objective)
2. [Overview](#overview)
1. [Show me the code!](#show-me-the-code)
2. [Implementation overview](#implementation-overview)
3. [Supported platforms](#supported-platforms)
4. [Development state](#development-state)
5. [Build](#build)
6. [Usage](#usage)
## Introduction ## Introduction
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 CPython. 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 CPython.
@@ -6,6 +15,9 @@ This language was written as a personal study of how interpreters and compilers
### Objective ### Objective
This project aims at being an interpreter design reference, therefore it optimizes for code quality and readability. That's not to mean that it won't be feature-complete. The end goal is to have a language you can do arbitrarily complex things in. This project aims at being an interpreter design reference, therefore it optimizes for code quality and readability. That's not to mean that it won't be feature-complete. The end goal is to have a language you can do arbitrarily complex things in.
## Overview
Noja is a very high level and dynamic language. It operates in the same range of abstraction as languages like Ruby, Python and Javascript.
### Show me the code! ### Show me the code!
Here's a basic example of a noja program that implements a bubble sort and uses it to sort a list Here's a basic example of a noja program that implements a bubble sort and uses it to sort a list
``` ```
@@ -32,19 +44,18 @@ do {
print(L, '\n'); # Outputs [1, 2, 3] print(L, '\n'); # Outputs [1, 2, 3]
``` ```
### Implementation Overview
The architecture is pretty much the same as CPython. The source code is executed by compilig it to bytecode. The bytecode is much more high level than what the CPU understands, it's more like a serialized version of the AST. For example, some bytecode instructions refer to variables by names, which means the compiler does very little static analisys. Memory is managed by a garbage collector that moves and compacts allocations.
(More detailed explanations are provided alongside the code.)
## Supported platforms ## Supported platforms
I wrote it on a linux machine, but there should be very few places where a linux host is assumed. It should be very easy to port. I wrote it on a linux machine, but there should be very few places where a linux host is assumed. It should be very easy to port.
## Development state ## Development state
The interpreter is fully functional, but lots of built-in functions that one would expect still need to be implemented. Unfortunately, I feel like this requires much more work than what it's worth at the moment. The interpreter is fully functional, but lots of built-in functions that one would expect still need to be implemented. Unfortunately, I feel like this requires much more work than what it's worth at the moment.
## Implementation overview
The architecture is pretty much the same as CPython. The source code is executed by compilig it to bytecode. The bytecode is much more high level than what the CPU understands, it's more like a serialized version of the AST. For example, some bytecode instructions refer to variables by names, which means the compiler does very little static analisys. Memory is managed by a garbage collector that moves and compacts allocations.
More detailed explanations are provided alongside the code.
## Build ## Build
To build it, just run: To build it, just run:
```sh ```sh
$ ./build.sh $ ./build.sh
@@ -58,7 +69,6 @@ $ chmod +x build.sh
``` ```
## Usage ## Usage
You can run files by doing: You can run files by doing:
```sh ```sh
location/of/noja run <filename> location/of/noja run <filename>