+20
.github/workflows/test.yml
+20
.github/workflows/test.yml
···
1
+
name: test
2
+
3
+
on:
4
+
push:
5
+
branches: [main]
6
+
pull_request:
7
+
8
+
jobs:
9
+
test:
10
+
runs-on: ubuntu-latest
11
+
steps:
12
+
- uses: actions/checkout@v4
13
+
- uses: erlef/setup-beam@v1
14
+
with:
15
+
otp-version: "27.1.2"
16
+
gleam-version: "1.12.0"
17
+
rebar3-version: "3"
18
+
- run: gleam deps download
19
+
- run: gleam test
20
+
- run: gleam format --check src test
+24
README.md
+24
README.md
···
1
+
# gbf
2
+
3
+
[](https://hex.pm/packages/gbf)
4
+
[](https://hexdocs.pm/gbf/)
5
+
6
+
```sh
7
+
gleam add gbf@1
8
+
```
9
+
```gleam
10
+
import gbf
11
+
12
+
pub fn main() -> Nil {
13
+
// TODO: An example of the project in use
14
+
}
15
+
```
16
+
17
+
Further documentation can be found at <https://hexdocs.pm/gbf>.
18
+
19
+
## Development
20
+
21
+
```sh
22
+
gleam run # Run the project
23
+
gleam test # Run the tests
24
+
```
+19
gleam.toml
+19
gleam.toml
···
1
+
name = "gbf"
2
+
version = "1.0.0"
3
+
4
+
# Fill out these fields if you intend to generate HTML documentation or publish
5
+
# your project to the Hex package manager.
6
+
#
7
+
# description = ""
8
+
# licences = ["Apache-2.0"]
9
+
# repository = { type = "github", user = "", repo = "" }
10
+
# links = [{ title = "Website", href = "" }]
11
+
#
12
+
# For a full reference of all the available options, you can have a look at
13
+
# https://gleam.run/writing-gleam/gleam-toml/.
14
+
15
+
[dependencies]
16
+
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
17
+
18
+
[dev-dependencies]
19
+
gleeunit = ">= 1.0.0 and < 2.0.0"
+11
manifest.toml
+11
manifest.toml
···
1
+
# This file was generated by Gleam
2
+
# You typically do not need to edit this file
3
+
4
+
packages = [
5
+
{ name = "gleam_stdlib", version = "0.65.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "7C69C71D8C493AE11A5184828A77110EB05A7786EBF8B25B36A72F879C3EE107" },
6
+
{ name = "gleeunit", version = "1.6.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "FDC68A8C492B1E9B429249062CD9BAC9B5538C6FBF584817205D0998C42E1DAC" },
7
+
]
8
+
9
+
[requirements]
10
+
gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" }
11
+
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
src/gbf.gleam
src/gbf.gleam
This is a binary file and will not be displayed.
+39
src/gbf/token.gleam
+39
src/gbf/token.gleam
···
1
+
pub type Token {
2
+
/// Everything that is not one of the tokens below, considered the be a comment
3
+
Comment
4
+
5
+
/// Increment the data pointer by one (to point to the next cell to the right).
6
+
/// `>` symbol
7
+
IncrementPointer
8
+
9
+
/// Decrement the data pointer by one (to point to the next cell to the left).
10
+
/// `<` symbol
11
+
DecrementPointer
12
+
13
+
/// Increment the byte at the data pointer by one.
14
+
/// `+` symbol
15
+
IncrementByte
16
+
17
+
/// Decrement the byte at the data pointer by one.
18
+
/// `-` symbol
19
+
DecrementByte
20
+
21
+
/// Output the byte at the data pointer.
22
+
/// `.` symbol
23
+
OutputByte
24
+
25
+
/// Accept one byte of input, storing its value in the byte at the data pointer.
26
+
/// `,` symbol
27
+
InputByte
28
+
29
+
/// If the byte at the data pointer is zero, then instead of moving the instruction pointer forward to the next command, jump it forward to the command after the matching ] command.
30
+
/// `[` symbol
31
+
StartBlock
32
+
33
+
/// If the byte at the data pointer is nonzero, then instead of moving the instruction pointer forward to the next command, jump it back to the command after the matching [ command.
34
+
/// `]` symbol
35
+
EndBlock
36
+
37
+
/// End of file
38
+
EOF
39
+
}
+13
test/gbf_test.gleam
+13
test/gbf_test.gleam