Discuss Scratch

-EmeraldThunder-
Scratcher
1000+ posts

Ember


Ember is a programming langauge that I am currently working on that will allow users to compile their programs directly to .sb3. This means that they may have an easier time moving from the visual environment of scratch to more advanced text based languages.
The first releases will be released sometime form late December to mid January although you are always welcome to clone the files from the GitHub repo and test some of your code on it.

Currenly I've finsihed building up a lexer and am starting on the main compiler. I've got a few ideas for syntax although I would like feedback on what to change.
Stage {
@green_flag{
var count = 0;
forever {
count++;
wait(0.5);
}
}
}

Sprite Cat {
@key('right_arrow') {
if x < 230 {
x += 10;
}
}

@key('left_arrow') {
if x > -230 {
x -= 10;
}
}
}

Please don't upload projects created with Ember to the website as it currenty violates the TOS.

What I'm currently working on:
I now need to compy out the opcodes of all blocks into a dictionary and implement global variables.

Last edited by -EmeraldThunder- (Jan. 1, 2022 07:00:19)


Nothing here.
NFlex23
Scratcher
1000+ posts

Ember

This looks amazing! I'm a huge fan of creating programming languages, so seeing this really excites me!

Edit: I believe using regular expressions in the `lexer.py` file would make it much simpler and more readable– of course that's just a personal opinion though; I love regexes.

Last edited by NFlex23 (Nov. 23, 2021 19:46:20)


Help improve the Advanced Topics (Really!)
Before you create a topic:
Always search for duplicates or other similar topics before making an umbrella topic, e.g., “The Mac Topic”.
  • Is it about something you are planning on making but haven't made yet? If so, please wait to post until you have created a working prototype. This is a key factor to keeping the ATs as clean as possible.
  • The ATs aren't technical support. It is perfectly valid to ask questions about things related to programming, but not issues with external websites, apps, or devices. Most sites have their own support system; try asking there!
  • Is it related to something you are making in Scratch? (This includes OSes and other Scratch projects) If so, please post in Collaboration, Show and Tell, or another similar forum.
  • Is your topic questionably “advanced”? Try browsing the other forums to see if your topic fits better in one of those.
  • Issues with Scratch itself should be put in Bugs and Glitches.
Before you post: Is what you're posting likely to start an argument or derail the thread (e.g., browsers, operating systems)? If so, please re-think your post!





god286
Scratcher
1000+ posts

Ember

wow! cool!!! I will try it soon

Here are some of my followers!

I joined: 5 years, 9 months, 24 days ago (31/03/2018)
I have: 479 followers
In total, I have attained: 1,403 loves, 1,145 favourites, and 33,731 views.
Fun Fact: If my account continued to gain followers at a similar rate to right now, in 14,210 years I would reach the number of followers griffpatch has today! Try to imagine how many followers he would have then!
Thank you everyone!
Script created by god286.
MagicCrayon9342
Scratcher
1000+ posts

Ember

-EmeraldThunder- wrote:


Ember is a programming langauge that I am currently working on that will allow users to compile their programs directly to .sb3. This means that they may have an easier time moving from the visual environment of scratch to more advanced text based languages.
The first releases will be released sometime form late December to mid January although you are always welcome to clone the files from the GitHub repo and test some of your code on it.

Currenly I've finsihed building up a lexer and am starting on the main compiler. I've got a few ideas for syntax although I would like feedback on what to change.
Stage {
@green_flag{
var count = 0;
forever {
count++;
wait(0.5);
}
}
}

Sprite Cat {
@key('right_arrow') {
if x < 230 {
x += 10;
}
}

@key('left_arrow') {
if x > -230 {
x -= 10;
}
}
}

Please don't upload projects created with Ember to the website as it currenty violates the TOS.

What I'm currently working on:
I'm trying to implement variables and blocks. Some variables will be built into the sprite such as the position as shown above.
very nice, I remember asking for this kind of thing a few weeks back! Good luck with the project
what coding language is this coding language written in?

Last edited by MagicCrayon9342 (Nov. 24, 2021 04:07:34)


god286
Scratcher
1000+ posts

Ember

MagicCrayon9342 wrote:

what coding language is this coding language written in?
I think it's Python. There is a GitHub repository in the first post.
also isn't there yet another javascript framework called ember?

Last edited by god286 (Nov. 24, 2021 04:10:34)


Here are some of my followers!

I joined: 5 years, 9 months, 24 days ago (31/03/2018)
I have: 479 followers
In total, I have attained: 1,403 loves, 1,145 favourites, and 33,731 views.
Fun Fact: If my account continued to gain followers at a similar rate to right now, in 14,210 years I would reach the number of followers griffpatch has today! Try to imagine how many followers he would have then!
Thank you everyone!
Script created by god286.
-EmeraldThunder-
Scratcher
1000+ posts

Ember

god286 wrote:

also isn't there yet another javascript framework called ember?
Yes that's why the official name is -ET-Ember

Nothing here.
god286
Scratcher
1000+ posts

Ember

I've changed quite a bit of the source code for it to run on my computer. Does the version in the repository work for you? Which file do I run?
I got this as a result after doing my changes:
[KEYWORD : stage, SCOPE_OPEN : {, EVENT_REGISTER : @, KEYWORD : green_flag, SCOPE_OPEN : {, KEYWORD : var, KEYWORD : count, ASSIGNMENT_OPERATOR : =, NUMBER : 0, LINE_TERMINATOR : ;, KEYWORD : forever, SCOPE_OPEN : {, KEYWORD : count, PLUS_OPERATOR : +, PLUS_OPERATOR : +, LINE_TERMINATOR : ;, KEYWORD : wait, LBRACKET : ( , NUMBER : 0.5, RBRACKET : ), LINE_TERMINATOR : ;, SCOPE_CLOSE : }, SCOPE_CLOSE : }, SCOPE_CLOSE : }, KEYWORD : sprite, KEYWORD : cat, SCOPE_OPEN : {, EVENT_REGISTER : @, KEYWORD : key, LBRACKET : ( , STRING : right_arrow, RBRACKET : ), SCOPE_OPEN : {, KEYWORD : if, KEYWORD : x, LANGLE_BR : {, NUMBER : 230, SCOPE_OPEN : {, KEYWORD : x, PLUS_OPERATOR : +, ASSIGNMENT_OPERATOR : =, NUMBER : 10, LINE_TERMINATOR : ;, SCOPE_CLOSE : }, SCOPE_CLOSE : }, EVENT_REGISTER : @, KEYWORD : key, LBRACKET : ( , STRING : left_arrow, RBRACKET : ), SCOPE_OPEN : {, KEYWORD : if, KEYWORD : x, RANGLE_BR : >, MINUS_OPERATOR : -, NUMBER : 230, SCOPE_OPEN : {, KEYWORD : x, MINUS_OPERATOR : -, ASSIGNMENT_OPERATOR : =, NUMBER : 10, LINE_TERMINATOR : ;, SCOPE_CLOSE : }, SCOPE_CLOSE : }, SCOPE_CLOSE : }]

Last edited by god286 (Nov. 24, 2021 06:57:58)


Here are some of my followers!

I joined: 5 years, 9 months, 24 days ago (31/03/2018)
I have: 479 followers
In total, I have attained: 1,403 loves, 1,145 favourites, and 33,731 views.
Fun Fact: If my account continued to gain followers at a similar rate to right now, in 14,210 years I would reach the number of followers griffpatch has today! Try to imagine how many followers he would have then!
Thank you everyone!
Script created by god286.
-EmeraldThunder-
Scratcher
1000+ posts

Ember

god286 wrote:

I've changed quite a bit of the source code for it to run on my computer. Does the version in the repository work for you? Which file do I run?
I got this as a result after doing my changes:
[KEYWORD : stage, SCOPE_OPEN : {, EVENT_REGISTER : @, KEYWORD : green_flag, SCOPE_OPEN : {, KEYWORD : var, KEYWORD : count, ASSIGNMENT_OPERATOR : =, NUMBER : 0, LINE_TERMINATOR : ;, KEYWORD : forever, SCOPE_OPEN : {, KEYWORD : count, PLUS_OPERATOR : +, PLUS_OPERATOR : +, LINE_TERMINATOR : ;, KEYWORD : wait, LBRACKET : ( , NUMBER : 0.5, RBRACKET : ), LINE_TERMINATOR : ;, SCOPE_CLOSE : }, SCOPE_CLOSE : }, SCOPE_CLOSE : }, KEYWORD : sprite, KEYWORD : cat, SCOPE_OPEN : {, EVENT_REGISTER : @, KEYWORD : key, LBRACKET : ( , STRING : right_arrow, RBRACKET : ), SCOPE_OPEN : {, KEYWORD : if, KEYWORD : x, LANGLE_BR : {, NUMBER : 230, SCOPE_OPEN : {, KEYWORD : x, PLUS_OPERATOR : +, ASSIGNMENT_OPERATOR : =, NUMBER : 10, LINE_TERMINATOR : ;, SCOPE_CLOSE : }, SCOPE_CLOSE : }, EVENT_REGISTER : @, KEYWORD : key, LBRACKET : ( , STRING : left_arrow, RBRACKET : ), SCOPE_OPEN : {, KEYWORD : if, KEYWORD : x, RANGLE_BR : >, MINUS_OPERATOR : -, NUMBER : 230, SCOPE_OPEN : {, KEYWORD : x, MINUS_OPERATOR : -, ASSIGNMENT_OPERATOR : =, NUMBER : 10, LINE_TERMINATOR : ;, SCOPE_CLOSE : }, SCOPE_CLOSE : }, SCOPE_CLOSE : }]
What did you have to change and what OS are you using, I get that when I run lexer.py.

Edit: It turns out there is a slight mistake on one line of the Lexer where I forgot to create an instance of Token.

Last edited by -EmeraldThunder- (Nov. 24, 2021 07:09:03)


Nothing here.
god286
Scratcher
1000+ posts

Ember

Your code works now!

Last edited by god286 (Nov. 24, 2021 07:17:18)


Here are some of my followers!

I joined: 5 years, 9 months, 24 days ago (31/03/2018)
I have: 479 followers
In total, I have attained: 1,403 loves, 1,145 favourites, and 33,731 views.
Fun Fact: If my account continued to gain followers at a similar rate to right now, in 14,210 years I would reach the number of followers griffpatch has today! Try to imagine how many followers he would have then!
Thank you everyone!
Script created by god286.
-EmeraldThunder-
Scratcher
1000+ posts

Ember

Does anyone think constants are worth implementing? It would just raise an error at compile if you try to change the value, not in mainstream scratch but may be found useful by someone.

Nothing here.
MagicCrayon9342
Scratcher
1000+ posts

Ember

-EmeraldThunder- wrote:

Does anyone think constants are worth implementing? It would just raise an error at compile if you try to change the value, not in mainstream scratch but may be found useful by someone.
YES!! https://en.wikipedia.org/wiki/Constant_(computer_programming)
very important feature

ScolderCreations
Scratcher
1000+ posts

Ember

-EmeraldThunder- wrote:

Does anyone think constants are worth implementing? It would just raise an error at compile if you try to change the value, not in mainstream scratch but may be found useful by someone.
I mean, if you use try/except, you can handle errors in a way that won't stop the entire program.

-EmeraldThunder-
Scratcher
1000+ posts

Ember

-Deleted-

Last edited by -EmeraldThunder- (Nov. 24, 2021 20:15:11)


Nothing here.
god286
Scratcher
1000+ posts

Ember

-EmeraldThunder- wrote:

I got this error when trying to push. What can I do?
To https://github.com/EmeraldThunder1/Ember.git
! [rejected] main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/EmeraldThunder1/Ember.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Oh I got that before!
Just run git pull and then push your changes

Here are some of my followers!

I joined: 5 years, 9 months, 24 days ago (31/03/2018)
I have: 479 followers
In total, I have attained: 1,403 loves, 1,145 favourites, and 33,731 views.
Fun Fact: If my account continued to gain followers at a similar rate to right now, in 14,210 years I would reach the number of followers griffpatch has today! Try to imagine how many followers he would have then!
Thank you everyone!
Script created by god286.
Scratch137
Scratcher
1000+ posts

Ember

This looks really cool! It'll be interesting to see where this goes.
-EmeraldThunder-
Scratcher
1000+ posts

Ember

Would people prefer if each sprite plus the stage needed its own file or is everybody happy with the concept in the description?

Nothing here.
NFlex23
Scratcher
1000+ posts

Ember

-EmeraldThunder- wrote:

Would people prefer if each sprite plus the stage needed its own file or is everybody happy with the concept in the description?
I like it the way it is: all the sprites in one file.

Help improve the Advanced Topics (Really!)
Before you create a topic:
Always search for duplicates or other similar topics before making an umbrella topic, e.g., “The Mac Topic”.
  • Is it about something you are planning on making but haven't made yet? If so, please wait to post until you have created a working prototype. This is a key factor to keeping the ATs as clean as possible.
  • The ATs aren't technical support. It is perfectly valid to ask questions about things related to programming, but not issues with external websites, apps, or devices. Most sites have their own support system; try asking there!
  • Is it related to something you are making in Scratch? (This includes OSes and other Scratch projects) If so, please post in Collaboration, Show and Tell, or another similar forum.
  • Is your topic questionably “advanced”? Try browsing the other forums to see if your topic fits better in one of those.
  • Issues with Scratch itself should be put in Bugs and Glitches.
Before you post: Is what you're posting likely to start an argument or derail the thread (e.g., browsers, operating systems)? If so, please re-think your post!





Scratch137
Scratcher
1000+ posts

Ember

NFlex23 wrote:

-EmeraldThunder- wrote:

Would people prefer if each sprite plus the stage needed its own file or is everybody happy with the concept in the description?
I like it the way it is: all the sprites in one file.
I second this; it's more accurate to the way that vanilla Scratch organizes the project.json file. It'd also help to fill the gap between it and a language like Python, where everything can more or less be handled by a single script.
god286
Scratcher
1000+ posts

Ember

Scratch137 wrote:

NFlex23 wrote:

-EmeraldThunder- wrote:

Would people prefer if each sprite plus the stage needed its own file or is everybody happy with the concept in the description?
I like it the way it is: all the sprites in one file.
I second this; it's more accurate to the way that vanilla Scratch organizes the project.json file. It'd also help to fill the gap between it and a language like Python, where everything can more or less be handled by a single script.
In my opinion it's best to put different parts of your code in different files. I think it's more organised and also allows you to reuse the code.

Here are some of my followers!

I joined: 5 years, 9 months, 24 days ago (31/03/2018)
I have: 479 followers
In total, I have attained: 1,403 loves, 1,145 favourites, and 33,731 views.
Fun Fact: If my account continued to gain followers at a similar rate to right now, in 14,210 years I would reach the number of followers griffpatch has today! Try to imagine how many followers he would have then!
Thank you everyone!
Script created by god286.
ninjaMAR
Scratcher
1000+ posts

Ember

i made a pr which added a gitignore and turned ember into a module. see the git repo for the pr

Powered by DjangoBB