New Language Generator

698 views
Skip to first unread message

Rimish Bansod

unread,
Apr 13, 2016, 8:59:47 AM4/13/16
to Blockly
Hello Sir,

I am developing new C language generator for Blockly. I have downloaded complete source code of blockly from github.
I want to know the following things.

1) which files require to made changes and which files should I create new ?
    tell me comparison with already present language generator

2) for new language generator how to include header files and all the libraries of that language.

3) how did you executed (Run) different language code after generating it? Which files should I edit for new language execution?

4) Should I create similar file like python_compressed.js and etc. in Root directory.   

Blake

unread,
Apr 13, 2016, 2:15:41 PM4/13/16
to Blockly
Greetings,

1.) You'll want to look at the files in the /generators folder. Dart will be the closest to a strongly typed language like C, I'd recommend starting there.

2.) Blockly currently doesn't have a built in way to include header files. The folks who put together the Zero Robotics editor have rolled their own solution. I created a similar solution for Java code which you can see here.

3.) In Blockly's code example the code that is executed is javascript. Pressing the run button always runs the javascript version of the code. To run C code you would need to use some sort of server to compile the code generated by blockly. Remember though that a malicious person could always send you any C code that could do bad things on your server machine if executed. There has been some work to get blockly to run in NodeJS in a headless mode purely for generating code on the server side.

4.) the _compressed.js files are created using the closure compiler. If you are going to add a new language you'll need to add it to the build.py file. 

Have you seen the Blockly Documentation? It has a great page introducing how the code generation works

Adding a new language generator is a considerable undertaking, Blockly currently does not have the robust type support needed to generate error free strongly typed code. Thankfully type support is on the roadmap. If your project isn't time sensitive, you might be better off waiting until type support can be added.

I encourage you to look at how others have implemented new languages, namely the PHP language generator. You can see in the pull request all of the code that was added to allow blockly to generate PHP. https://github.com/google/blockly/pull/101

I hope this helps,
Blake

--
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.

Rimish Bansod

unread,
Apr 14, 2016, 12:44:49 AM4/14/16
to blo...@googlegroups.com
Hello sir,
I have seen you have already developed Easyj4frc.
I want to develope the same thing.
I want to develope it for Atmega 8, Atmega 16, Atmega 128 micro controllers.
All the solution on internet is given about Arduino board.
I want to program Atmega 8, 16, 128 microcontroller using blockly.
for that purpose
I need to following things
1) Convert blockly code into C generator
2) Include Avr family libraries for Atmega 8, 16, 128 in C generator and include all required libraries
3) compiler for compiling the code
4) Programmer library to to dump code into microcontroller
I need your step by step guidance

As i can see you have already developed it for FRC Robot


--
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/xsTJxDp5t4g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Regards,
Rimish Bansod,
Sales Executive,


Robolab Technologies Private Limited,


BHAU institute of Innovation, Entrepreneurship, 

and Leadership. 


College Of Engineering Pune- 411005


Mobile   (+91) 7028 25 7052           

Website  www.robolab.in

Follow us on LinkedInhttps://www.linkedin.com/company/robolab-technologies

 


Confidentiality Notice:

This email is intended only for the individual(s) to whom it is addressed and may contain information that is confidential or privileged. If you are not the intended recipient(s), or the employee or person responsible for delivering it to the intended recipients(s), please notify the sender immediately and destroy all copies of this message and attachments if any.



Carlos Pereira

unread,
Apr 15, 2016, 8:04:23 AM4/15/16
to Blockly
Dear Rimish,

What you are requesting involves a significant amount of work and effort, and it is a bit unreasonable to ask for step-by-step instructions.
Blake has been quite kind to give you solid guidance on how to go about achieving your goal, but it is not something that exists as a working solution right now. Keep in mind that Easyj4frc generates Java code specific for the FRC robots, and you are looking for a general C general, which on top of that compiles and loads the software into a very specific set of microcontrolllers.

My best advice would be to have a look at what at the Arduino versions of Blockly (or any other C microcontrollers) are doing, and try to adapt those to your needs. And please keep in mind that it will involve modifying the Blockly code, and finding a way to interface with your desktop tools to program your desire platform.

Kind Regards,
Carlos
Reply all
Reply to author
Forward
0 new messages