# @tevcodes/tox

> Tox Programming language

Latest version **1.1.2** (published 2020-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tevcodes/tox
pnpm add @tevcodes/tox
yarn add @tevcodes/tox
bun add @tevcodes/tox
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2020-08-22 |
| First published | 2020-04-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 204.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tevinthuku |

## Links

- npm: https://www.npmjs.com/package/@tevcodes/tox
- npm.io page: https://npm.io/package/@tevcodes/tox

## Recent versions

- 1.1.2 (latest) — 2020-08-22
- 1.0.2 — 2020-05-17
- 1.0.1 — 2020-04-24
- 1.0.0 — 2020-04-24

## README

## Tox

Tox is a small programming language that has been inspired by the Jlox programming language from https://craftinginterpreters.com/

The scanner, parser & interpreter have all been built by hand, no external library has been involved

## Running Tox Locally

1. Clone this project
2. Create a `src` folder on the root.
3. Run `npm install` and `npm run build:watch`
4. Open a new terminal and run `node src/tox.js file test.tox` to run a file (test.lox is in the root)
5. To run the repl run `node src/tox.js repl`

## Syntax

The syntax is similar to Javascript for the most part.

### Variable declaration

```
let number = 12;
let name = "hundred";
```

### Looping

#### For loops

```
  for(let i = 0; i < 5; i = i + 1) {
    log i;
  }
```

#### While loops

```
let num = 0
while(num < 5) {
    log "Running";
    num = num + 1;
}
```

### Functions

```
fn greetings(name) {
    return "Hello " + name;
}

log greetings("World");
```

### Conditionals

```
let answer = "work";
if(answer == "work") {
    log "correct";
} else {
    log "try again";
}
```

```
log nil or "twelve"; // prints "twelve"
```

### Extra features.

#### Do Statement.
I took inspiration from the `do expression` that's currently an [Ecmascript expression](https://github.com/tc39/proposal-do-expressions) 

```
let a = 12;
do {
  if(a == 111) {
    log("true");
  } else {
    log("false"); //logs false here
  }
}
```

---
_Source: https://npm.io/package/@tevcodes/tox · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
