Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add p/demo/bf (brainfuck vm) #885

Merged
merged 4 commits into from
Jul 6, 2023
Merged

feat: add p/demo/bf (brainfuck vm) #885

merged 4 commits into from
Jul 6, 2023

Conversation

moul
Copy link
Member

@moul moul commented Jun 10, 2023

Signed-off-by: Manfred Touron 94029+moul@users.noreply.github.com

Description

Please provide a detailed description of the changes made in this pull request.

Contributors Checklist

  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests

Maintainers Checklist

  • Checked that the author followed the guidelines in CONTRIBUTING.md
  • Checked the conventional-commit (especially PR title and verb, presence of BREAKING CHANGE: in the body)
  • Ensured that this PR is not a significant change or confirmed that the review/consideration process was appropriate for the change

Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
@moul moul self-assigned this Jun 10, 2023
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Jun 10, 2023
@thehowl
Copy link
Member

thehowl commented Jun 12, 2023

Just gotta make it run https://github.com/matslina/awib to see Gno compile BF to i386 binaries :)

@moul moul marked this pull request as ready for review June 16, 2023 10:56
@moul moul requested a review from a team as a code owner June 16, 2023 10:56
@moul
Copy link
Member Author

moul commented Jun 16, 2023

Next step: EVM.

moul added 2 commits June 20, 2023 17:34
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
Comment on lines +37 to +48
// Jump forward past the matching ']' if the byte at the memory pointer is zero
if memory[pointer] == 0 {
braceCount := 1
for braceCount > 0 {
i++
if code[i] == '[' {
braceCount++
} else if code[i] == ']' {
braceCount--
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could make this use a stack of open brackets, popped each time we go out of a loop, probably better for memory/efficiency... but if you don't want to do it it's fine :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's keep this for when we'll have better benchmarking tools as a good example of runtime and gas optimization.

Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
@moul moul merged commit 847594b into gnolang:master Jul 6, 2023
@moul moul deleted the dev/moul/bf branch July 6, 2023 20:18
Doozers pushed a commit to Doozers/gno that referenced this pull request Aug 31, 2023
@moul moul added this to the 🌟 main.gno.land (wanted) milestone Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: ✅ Done
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants