Skip to content

Commit

Permalink
Updating README.md, ROADMAP.md, CHANGELOG.md
Browse files Browse the repository at this point in the history
- Added tests from README, as they previously failed!
- Bug #127 in ImlValue should be fixed later, as it is a design issue
  • Loading branch information
phorward committed Dec 16, 2023
1 parent e5b7566 commit a10b45a
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 23 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Current main branch.

- Implementation of generic parselets
- v0.6.5: Implementation of generic parselets
- Syntax changes
- Handle parselet instances
- Handle generic values in intermediate structures
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ Tokay is still a very young project and gains much potential. [Volunteers are we
- Implements a memoizing packrat parsing algorithm internally
- Robust and fast, as it is written entirely in safe [Rust](https://rust-lang.org)
- Enabling awk-style one-liners in combination with other tools
- Generic functions and parselets (*coming soon)
- Generic parselets and functions
- Import system to create modularized programs (*coming soon)
- Embedded interoperability with other programs (*coming soon)

## Installation

Using Rusts dependency manager and build-tool `cargo`, simply install Tokay with
By using Rusts dependency manager and build-tool `cargo`, simply install Tokay with

```bash
$ cargo install tokay
```

Alternatively, there's also a [`tokay`](https://aur.archlinux.org/packages/tokay) and [`tokay-git`](https://aur.archlinux.org/packages/tokay-git) package in the [Arch Linux AUR](https://aur.archlinux.org/).
For Arch Linux-based distros, there is also a [`tokay`](https://aur.archlinux.org/packages/tokay) and [`tokay-git`](https://aur.archlinux.org/packages/tokay-git) package in the [Arch Linux AUR](https://aur.archlinux.org/).

## Examples

Expand All @@ -73,11 +73,11 @@ print("Hello World")
Tokay can also greet any wor(l)ds that are being fed to it. The next program prints "Hello Venus", "Hello Earth" or "Hello" followed by any other name previously parsed by the builtin `Word`-token. Any other input than a word is automatically omitted.

```tokay
world => Word print("Hello " + $world)
print("Hello", Word)
```

> ```
> $ tokay 'world => Word print("Hello " + $world)' -- "World 1337 Venus Mars 42 Max"
> $ tokay 'print("Hello", Word)' -- "World 1337 Venus Mars 42 Max"
> Hello World
> Hello Venus
> Hello Mars
Expand All @@ -87,26 +87,26 @@ world => Word print("Hello " + $world)
A simple program for counting words which exists of a least three characters and printing a total can be implemented like this:

```tokay
Word(min=3) ++words accept
end words
Word(min=3) words += 1
end print(words)
```

> ```
> $ tokay "Word(min=3) ++words accept; end words" -- "this is just the 1st stage of 42.5 or .1 others"
> $ tokay "Word(min=3) words += 1; end print(words)" -- "this is just the 1st stage of 42.5 or .1 others"
> 5
> ```
The next, extended version of the program from above counts all words and prints any numbers.
The next, extended version of the program from above counts all words and numbers.

```tokay
Word ++words accept
Number
end words + " words"
Word words += 1
Number numbers += 1
end print(words || 0, "words,", numbers || 0, "numbers")
```

> ```
> $ tokay 'Word ++words accept; Number; end words + " words"' -- "this is just the 1st stage of 42.5 or .1 others"
> (1, 42.5, 0.1, "9 words")
> $ tokay 'Word words += 1; Number numbers += 1; end print(words || 0, "words,", numbers || 0, "numbers")' -- "this is just the 1st stage of 42.5 or .1 others"
> 9 words, 3 numbers
> ```
By design, Tokay constructs syntax trees from consumed information automatically.
Expand Down
14 changes: 8 additions & 6 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ This document describes upcoming changes to achieve with a specific version.
- [x] Keyword<P> (#121)
- [ ] Until<P, Escape: '\\'>
- [ ] String<Start, End: Void, Escape: '\\'>
- [ ] Implement embedded parselets (#120)
- [ ] New list syntax `[...]`, redefining sequence/`dict` syntax (#100)
- The character-class token syntax was replaced by a `Char`-builtin
- List definition `list = []`
- Dict definition `dict = ()`
- Builtins `dict` and `list` should become obsolete, so variables can take their names
- [ ] Implement inlined parselets (#120)
- [ ] New list syntax `,`, redefining sequence/`dict` syntax (#100)
- Top-level `list` definition `list = ,`
- Top-level `dict` definition `dict = ()`

## 0.8

- [ ] Importable modules
2 changes: 1 addition & 1 deletion src/compiler/iml/imlvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl ImlValue {
None
}
}
Err(_) => todo!("Recursive resolve()"),
Err(_) => todo!("Recursive resolve() impossible by design, see bug #127"),
},
Self::Name { offset, name, .. } => compiler.get(offset.clone(), &name),
Self::Instance {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/parselet_generic_selfref.tok
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Y<'a'> print("Ja!")
X<'x'> print("Jx!")
#---
#ERR:SKIP
#ERR:not yet implemented: Recursive resolve()
#ERR:not yet implemented: Recursive resolve() impossible by design, see bug #127
#ERR:SKIP
7 changes: 7 additions & 0 deletions tests/readme_count_word.tok
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Word(min=3) words += 1
end print(words || 0)
#---
#this is just the 1st stage of 42.5 or .1 others
#---
#5
#("this", "just", "the", "stage", "others")
9 changes: 9 additions & 0 deletions tests/readme_count_word_and_number.tok
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Word words += 1
Number numbers += 1

end print(words || 0, "words,", numbers || 0, "numbers")
#---
#this is just the 1st stage of 42.5 or .1 others
#---
#9 words, 3 numbers
#("this", "is", "just", "the", 1, "st", "stage", "of", 42.5, "or", 0.1, "others")
8 changes: 8 additions & 0 deletions tests/readme_hello_word.tok
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
print("Hello", Word)
#---
#World 1337 Venus Mars 42 Max
#---
#Hello World
#Hello Venus
#Hello Mars
#Hello Max

0 comments on commit a10b45a

Please sign in to comment.