Here's our work: Blockly for C language

5,198 views
Skip to first unread message

정인호

unread,
Jul 14, 2016, 5:01:20 AM7/14/16
to Blockly
Hello :)

We are a team working on adding new language to Blockly,
and here is our team's work: Blockly for C language.

We temporally call this project "Cake", just because this is for C language :P

Originally this project is based on somewhere 2014 version of Blockly.

And total develop period is from July 8th, 2014 to June 3rd, 2015, about 1 year. But we are still in developing.

You can try Cake on https://cra16.github.io/cake-core/ (if you find bugs, please feedback us! https://github.com/cra16/cake-core/issues/new )


Here's major feature list of Cake(Some feature may implemented on latest Blockly):
  • Customized block for C
  • Typed variable
  • C Structure
  • Pointer (up to triple pointer)
  • C syntax error checking
  • Array (up to 3 dimensions)
    • Array index checking
  • Type checking
  • C code generator
  • Auto import C header
  • C basic library
    • stdio
    • stdlib
    • string
    • math
    • time
  • Error safe C code generating
Because we expanded and rewritten original Blockly core part and many other part, where made maintenance very difficult.

We are now rewriting our code to match up with latest Blockly's code, 
by forking Blockly on Github and using Inheritance feature of Google Closure, to enable developing without hassle.

And I'd like ask a question: Does it feasible to add new language to Blockly by inherit Blockly core and Blockly blocks?

Thank you

Joshua

Yukti Mehta

unread,
Jul 15, 2016, 1:29:34 AM7/15/16
to Blockly
Great Work guys !! I wanted to know that only download button is working. Are you working on all other buttons or is there a problem with my browser !

Thanks Much
Yukti Mehta

Joshua

unread,
Jul 16, 2016, 4:57:28 AM7/16/16
to Blockly
Hello, Yukti.

Thank you for testing it! That github page is just a proof of concept, and we are working on more on that. Right now only download and delete all button are working.

Thanks
Joshua

2016년 7월 15일 금요일 오후 2시 29분 34초 UTC+9, Yukti Mehta 님의 말:

Zubair Quraishi

unread,
Jul 16, 2016, 5:22:38 AM7/16/16
to Blockly
very nice. I wanted to make a "hello world" app but it wasn't so obvious how to do it. could you provide a video demo too?

Blake

unread,
Jul 16, 2016, 12:50:00 PM7/16/16
to Blockly
Zubair,

Something like this:





--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Zubair Quraishi

unread,
Jul 17, 2016, 1:49:13 AM7/17/16
to Blockly
Thats what I did.... hmm. I'll have to go back to it as somehow it didn't run.. but still it wasn't so obvious for me. I guess this is useful but the user has to know C first, right?

Blake

unread,
Jul 17, 2016, 9:08:17 AM7/17/16
to Blockly
So if you mean the Console portion, I couldn't figure out how to use that either.

Joshua

unread,
Jul 17, 2016, 9:09:55 PM7/17/16
to Blockly
I removed UI which is not implemented yet. Sorry for confusing.

Joshua

2016년 7월 17일 일요일 오후 2시 49분 13초 UTC+9, Zubair Quraishi 님의 말:

Blake

unread,
Jul 17, 2016, 11:07:52 PM7/17/16
to Blockly
When I press the trash button, it removes the main function block. I don't see that special main block in the menus. Is that intended behavior?

Inline image 1

Joshua

unread,
Jul 17, 2016, 11:21:44 PM7/17/16
to Blockly
No, it should be preserved. I set no move and no delete attribute on that main block, but for some reason, it is not working...
Now I edited the code to recreate the main block after "delete all" task.

Joshua


2016년 7월 18일 월요일 오후 12시 7분 52초 UTC+9, Blake Bourque 님의 말:

Cody Blakeney

unread,
Jul 19, 2016, 12:39:50 AM7/19/16
to Blockly
I really like your C language generator. One thing I noticed is I don't seem to be able to print ints ... or atleast I cannot connect a function to print with a return type int, and there doesn't seem to be a way to convert an int to a string. 

looks good though

Cole Dube

unread,
Oct 28, 2016, 1:08:05 PM10/28/16
to Blockly


This program looks great. Very good job editing the playground environment to match your needs. I am working on a blockly project as well and was very curious, how did you all get the automated code generation every time you add a block as opposed to having to press a button everytime to translate blocks to code?

정인호

unread,
Oct 29, 2016, 12:19:09 AM10/29/16
to Blockly

2016년 10월 29일 (토) 오전 2:08, Cole Dube <dube...@gmail.com>님이 작성:


This program looks great. Very good job editing the playground environment to match your needs. I am working on a blockly project as well and was very curious, how did you all get the automated code generation every time you add a block as opposed to having to press a button everytime to translate blocks to code?

--
You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/zOTG-ma6FA4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+u...@googlegroups.com.

GB-)

unread,
Apr 12, 2017, 9:15:25 AM4/12/17
to Blockly
I've had a quick look at your Blockly for C. Very well done.

Currently, the print statements require C++.
So you might want to change that to be C, or change the title of the project to Blockly for C++.

As C for Blockly only allows one item to be printed, the C++ could be replaced with `printf("%s\n", variablename);`
This is better than `printf(variablename);` because the variable could contain % followed by a valid format verb (eg %x) which could blow up at run time after the C program has been compiled, or print something which is inexplicable to a beginning C programmer.

An alternative would be `puts(variablename);` which avoids any problems caused of using variablename as a printf format string.
However, puts doesn't generalise to printing a number; `printf("%d\n", variablename);` prints an integer. Also printf could generalise to printing more than one variable or value at a time.

I would strongly encourage you to replace any C++ with C because C is a much smaller language. You could complete C much more quickly and with less effort than C++.

HTH
GB-)

Joshua

unread,
Apr 13, 2017, 1:28:56 AM4/13/17
to Blockly
Dear GB-)

Thank you for your feedback.
A few months ago, this project had some changes internally.
The first is that the name of this project has changed from Cake to HIPE, and the second one is starting to support a little C ++ language set.

The current project is going very slowly because all contributors are busy with their lives.

Thanks again for your feedback.

With kindness
Joshua

2017년 4월 12일 수요일 오후 10시 15분 25초 UTC+9, GB-) 님의 말:

Anwen Deng

unread,
Sep 20, 2017, 11:25:30 PM9/20/17
to Blockly
Hello.
I used your  blockly stuff https://cra16.github.io/cake-core/  to aid the students to learn the very beginning C++ programming.

It's a nice work.

anwendeng
Joshua於 2016年7月14日星期四 UTC+8下午5時01分20秒寫道:

Anwen Deng

unread,
Sep 22, 2017, 10:35:18 PM9/22/17
to Blockly
Hello.

I think that it is doable using Blockly to generate elementary C++ code, especially in combination with some C++ IDE.

Some suggestions:

1. the for-loop may  be revised to fit the C/C++ programmer's style; I'd like to using local variable for the control variables.
2. add the random functions, time() functions.

thanks for the excellent work

anwendeng

Joshua於 2016年7月14日星期四 UTC+8下午5時01分20秒寫道:

socks4p...@gmail.com

unread,
Sep 23, 2017, 10:18:19 PM9/23/17
to Blockly
That's fantastic well done.  You will save alot of head scratching for people learning C.

Rolando Silvestro

unread,
Nov 14, 2017, 4:29:41 AM11/14/17
to Blockly
Dear Joshua

Can you post the git link of the project hipe (old cake)?

Thank you very much


Rolando Silvestro

Sunny Bhadana

unread,
Sep 9, 2018, 9:44:42 PM9/9/18
to Blockly
Hey,
I'm trying to use a already saved xml file but I'm unable to import a simple xml file.
I'm getting this error
blockly_compressed.js:918 Uncaught TypeError: Cannot read property '0' of undefined
at Object.Blockly.Xml.domToWorkspace (blockly_compressed.js:918)
at importXML (code.js:68)
at <anonymous>:1:1

This is my function in code.js
function importXML(xmlCode){   
  var xml = Blockly.Xml.textToDom(xmlCode);
          Blockly.Xml.domToWorkspace(xml, Blockly.mainWorkspace);
  return true;

I don't understand what happened in with my code, here is my simple code, I'm using like this:

importXML('<xml xmlns="http://www.w3.org/1999/xhtml"><block type="main_block" id="2" inline="false" x="274" y="40"></block></xml>');

Please tell me if there is problem with my code  
 

Александр К-ш

unread,
Apr 25, 2022, 3:57:25 PM4/25/22
to Blockly
Hello. When I started this development environment (Blockly for C language), I saw that there is already a block by default. Only I don’t know what it does, what commands it has for what. Tell me please. And one more question. If I don’t want to start writing code from this block by default, is it possible, and if it makes sense and such an opportunity, then how to remove it?

понедельник, 10 сентября 2018 г. в 06:44:42 UTC+5, Sunny Bhadana:
Reply all
Reply to author
Forward
0 new messages