<commit_before>
## Hazelnut

![hazelnut logo](logo/hazelnut.png)

Hi! Hazelnut is a programming language I'm working on.
It's pretty simple, with the main goal being to bootstrap
itself as quickly as possible. It compiles to Go.

# Syntax

## Haskell-like function calls

```ruby
assert (equals this that)
```

There are no operators, for simplicity.

## Blocks

Inspired by the ruby blocks:
```
map (list 3 4 5) { x: * x x }
```

Fun fact: the `:` here is an alias for a newline or semicolon. This is also valid:

```
map (list 3 4 5) do x
  * x x
end
```

You've probably gotten by now that Hazelnut dynamically typed (and still compiles to Go), 
Hazelnut by default returns the last line in a block.

## That's it!

That's all the syntax there is. It's not quite as simple as lisp, but the AST is very simple:
each node has a name, a list of nodes and a block, which has a list of identifiers and a list of nodes.
```
       Node
      / | \
     /  |  \
    /   |   \
Name Arguments Block
 |       |       |   \
 |       |       |    \
Ident  [Node]  [Node] [Ident]
```
* By "Ident", I mean a literal word in the text, like "if" or "return" or "fish".

My hope is that this will make macros easy, although I haven't gone about implementing them yet.

# Progress

* [ ] Finish the first compiler
  - [x] Parse the tokens
  - [x] Parse the ast
  - [x] Generate function calls
  - [x] Generate `if` and `else` statements
  - [x] Generate `let` statements
  - [x] Differentiate between vars and function calls
  - [x] Generate function definitions
  - [x] Command line tool
  - [x] Constants
      * [x] Integers
      * [x] Booleans
      * [x] Floats
      * [x] Strings
      * [x] Structs
  - [x] Bindings to Go code
  - [x] Use a different namespace for Hazelnut functions
  - [ ] Support dot syntax and methods
  - [ ] Make namespaces and 'include' for hazelnut
  - [ ] Better error messages
  - [ ] Support for panic and defer
* [ ] Bootstrap
* [ ] Add macros w/ interpreter!
<commit_msg>Added some documentation to readme<commit_after>
## Hazelnut

![hazelnut logo](logo/hazelnut.png)

Hi! Hazelnut is a programming language I'm working on.
It's pretty simple, with the main goal being to bootstrap
itself as quickly as possible. It compiles to Go.

# Syntax

## Haskell-like function calls

```ruby
assert (= this that)
```

## Operators

Postfix or prefix

```ruby
2 + 3 * 8
```

```ruby
(+ 2 (* 3 8))
```

## Blocks

Inspired by the ruby blocks:
```
map (list 3 4 5) { x: x * x }
```

Fun fact: the `:` here is an alias for a newline or semicolon. This is also valid:

```
map (list 3 4 5) do x
  x * x
end
```

You've probably gotten by now that Hazelnut dynamically typed (and still compiles to Go), 
Hazelnut by default returns the last line in a block.

## That's it!

That's all the syntax there is. It's not quite as simple as lisp, but the AST is very simple:
each node has a name, a list of nodes and a block, which has a list of identifiers and a list of nodes.
```
       Node
      / | \
     /  |  \
    /   |   \
Name Arguments Block
 |       |       |   \
 |       |       |    \
Ident  [Node]  [Node] [Ident]
```
* By "Ident", I mean a literal word in the text, like "if" or "return" or "fish".

My hope is that this will make macros easy, although I haven't gone about implementing them yet.

# Features

## Functions

```ruby
define add_2 { x: x + 2 }
```

## Structures
```ruby
struct Animal {
  color
  height
}

a = new animal
a.color = "red"
```

## Control Flow

```ruby
if is_red panda {
  puts "This is a red panda!"
} else {
  puts "This is not a red panda!"
}
```

There aren't for loops yet but that's just because I haven't gotten to them.

# Progress

* [ ] Finish the first compiler
  - [x] Parse the tokens
  - [x] Parse the ast
  - [x] Generate function calls
  - [x] Generate `if` and `else` statements
  - [x] Generate `let` statements
  - [x] Differentiate between vars and function calls
  - [x] Generate function definitions
  - [x] Command line tool
  - [x] Constants
      * [x] Integers
      * [x] Booleans
      * [x] Floats
      * [x] Strings
      * [x] Structs
  - [x] Bindings to Go code
  - [x] Use a different namespace for Hazelnut functions
  - [x] Operators with shunting yard
  - [ ] Support dot syntax and methods
  - [ ] Make namespaces and 'include' for hazelnut
  - [ ] Better error messages
  - [ ] Support for panic and defer
* [ ] Bootstrap
* [ ] Add macros w/ interpreter!

{'fraction_non_alphanumeric': 0.10843644544431946, 'fraction_numerical': 0.0044994375703037125, 'mean_word_length': 2.7298657718120807, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3035813', 'n_tokens_mistral': 1542, 'n_tokens_neox': 1440, 'n_words': 641}