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

Add Grain language support #712

Merged
merged 4 commits into from
Jun 2, 2024
Merged

Add Grain language support #712

merged 4 commits into from
Jun 2, 2024

Conversation

tjpalmer
Copy link
Contributor

@tjpalmer tjpalmer commented Apr 24, 2024

  • Mostly copy from https://github.com/ospencer/wasm4-gr
  • Adjust some to fit in nicely here as a template
  • Add a \x byte string format for png2src
  • No site docs update yet if that's ok to put in a separate PR

from "uint8" include Uint8
use Uint8.{ (+), (-), (&), (>), (==) }

let smiley = b"\xc3\x81\x24\x24\x00\x24\x99\xc3"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested a variation of this example using png2src output instead of the manual things here, and it worked for me.

The original example here also worked for me. I used a manually built Grain 0.6.3.

@@ -29,6 +29,8 @@ function requireLang (opts) {
return "d";
} else if (opts.go) {
return "go";
} else if (opts.grain) {
return "grain";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I testing making a new project as well as png2src.

@@ -77,7 +77,7 @@ function start (opts) {
return skip
} else {
// Only trigger on source file changes
return /\.(c|cpp|d|go|h|nelua|nim|odin|pn|porth|rol|rs|ts|wat|zig)$/.test(file);
return /\.(c|cpp|d|go|gr|h|nelua|nim|odin|pn|porth|rol|rs|ts|wat|zig)$/.test(file);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had trouble getting watch working in general, but this is the right suffix for grain.

@@ -27,6 +27,8 @@
"gamedev",
"go",
"golang",
"grain",
"grainlang",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some other languages are missing from this tag list, but I didn't add others in this PR.

@@ -8,6 +8,7 @@ const classNameToLanguage = {
"language-c3": "c3",
"language-cpp": "c",
"language-d": "d",
"language-grain": "grain",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't even know what this file is, but I added grain alongside the other languages.

@aduros
Copy link
Owner

aduros commented Jun 2, 2024

Thanks Tom! I haven't tried out the latest version of Grain yet, but this looks really useful.

@aduros aduros merged commit 5c1f280 into aduros:main Jun 2, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants