AI Designer source

311 views
Skip to first unread message

Geo Massar

unread,
Feb 18, 2012, 4:03:41 PM2/18/12
to App Inventor Open Source Development
I gather one of those files zipped in the source downloaded from the
AI Designer is the file designated for the component layout. Its
extension is .SCM which is not a Scheme source as I first thought. It
appears to be a JSON source which could be easily converted to XML or
even Java file. Use one of JSON formatters/editors available to format
the file into a more readable source.

So, where could I find in the source repo that reads the mentioned
file?

Thank you.

Geo

Sharon Perl

unread,
Feb 18, 2012, 6:09:49 PM2/18/12
to Geo Massar, App Inventor Open Source Development
Yes, sorry about that! The ".scm" file is poorly named. Perhaps at one time we thought we'd put scheme in there---I don't remember. What it actually contains is the description of the components (JSON formatted, as you said) added by the user, with any property settings. The component layout is done programmatically. The code that processes the JSON file is in blockslib/src/openblocks/yacodeblocks/YABlockCompiler.java. That file and BlockParser.java in the same directory handle the scheme intermediate language generation. Also relevant is buildserver/src/com/google/appinventor/buildserver/resources/runtime.scm, which contains the scheme runtime code.


Geo

--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.
To post to this group, send email to app-inventor-o...@googlegroups.com.
To unsubscribe from this group, send email to app-inventor-open-so...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/app-inventor-open-source-dev?hl=en.


Gary Frederick

unread,
Feb 19, 2012, 5:51:42 AM2/19/12
to app-inventor-o...@googlegroups.com, Geo Massar
Great info Sharon, thanks

I vaguely remember in the old days that the App Inventor zip files could contain three source files
  .scm => the JSON from the Designer
  .blk ?=> the XML from the Blocks Editor

and?
  .yail that was the yail from the Blocks Editor?

Do the source zips only have the two files now (.scm and .blk)?

Gary

Geo Massar

unread,
Feb 19, 2012, 4:59:32 PM2/19/12
to app-inventor-o...@googlegroups.com
And...

The blk file appears to be a set of Scheme expressions generated by Blocks Editor (block-building/programming tool.)

I am more particularly interested in the scm file which is actually a JSON notations generated by AI Designer. The idea is to translate the source into outputs for various fields such as documentation/wiki tables for tutorials, $define {...} section code for Java Bridge framework, XML tags for Android SDK (main.XML) and so forth.

Since I am a pretty old man (80 next month) with a relatively poor vision, I would rather to have a couple of project teams, one for design part and other for programming part, to translate AI source ("scm" and blk files) into other languages  for various platforms, Java Bridge, pure Java, HTML5, etc. The translation is basically used for educational purpose to teach both young and pro developers.
 
What ye say, folks?

Geo

PS Thanks, Sharon, for the pointers.

Roger Belk

unread,
Feb 19, 2012, 9:53:17 PM2/19/12
to Geo Massar, app-inventor-o...@googlegroups.com
I will help in any way I can, Remember I am one of the new programmers.
Thanks,
Big Daddy App
www.BigDaddyApp.com
Follow Big Daddy on Twitter
BIG DADDY APP's APPS
JOIN BDA on FACEBOOK



--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.

Geo Massar

unread,
Feb 19, 2012, 10:37:23 PM2/19/12
to Roger Belk, app-inventor-o...@googlegroups.com
Thank you, Roger, for your offer. We will keep it in mind.

Geo

Geo Massar

unread,
Feb 19, 2012, 11:46:25 PM2/19/12
to app-inventor-o...@googlegroups.com
I just happened to save a source for HelloPurr downloaded from Google server last year (Nov). The source contains three files, namely, screen1.blk, screen1.scm and screen1.yail. In the comparison, the source downloaded from an experimental server using MIT jars (build 61} no longer contains the yail file.

Is there any explanation why it is missed/removed?

In fact, I am glad it is missed. Only the first two files are sufficient for the new tool, I believe..

Geo

Sharon Perl

unread,
Feb 20, 2012, 12:20:46 AM2/20/12
to Geo Massar, app-inventor-o...@googlegroups.com
The yail file is the generated scheme code from some version of the blk file. It was never guaranteed to be up-to-date with the source in the latest version of the blk file. You can ignore it in any old source zips that you have. I beileve it is only of interest during the build process, when it will be generated fresh from the blk and files. Note that in the latest version of App Inventor with multiple screens there can be multiple scm and blk files, one set per screen.

Gary Frederick

unread,
Feb 20, 2012, 6:16:49 AM2/20/12
to app-inventor-o...@googlegroups.com

On Sunday, February 19, 2012 3:59:32 PM UTC-6, Geo Massar wrote:
And...

The blk file appears to be a set of Scheme expressions generated by Blocks Editor (block-building/programming tool.)

The blk file is the info the Blocks Editor needs. It includes info about blocks that have been dragged out of the drawer, where they are located and what is connected to what and how they are connected.


I am more particularly interested in the scm file which is actually a JSON notations generated by AI Designer. The idea is to translate the source into outputs for various fields such as documentation/wiki tables for tutorials, $define {...} section code for Java Bridge framework, XML tags for Android SDK (main.XML) and so forth.

!!!
 

Since I am a pretty old man (80 next month) with a relatively poor vision, I would rather to have a couple of project teams, one for design part and other for programming part, to translate AI source ("scm" and blk files) into other languages  for various platforms, Java Bridge, pure Java, HTML5, etc. The translation is basically used for educational purpose to teach both young and pro developers.

Since I am a relatively old man with poor attention span...
Sounds like a cathedral. If you can get folks to commit to that model of development, woo hoo.

And

I want to generate Java and HTML from App Inventor source. One use would be for education, another to use App Inventor as a prototype step for building apps. An interesting use would be editing the source to add strings or similar blocks in a way that is more convenient than using the Blocks Editor.

  
What ye say, folks?

How will the project you are thinking of be licensed?
 

Geo

PS Thanks, Sharon, for the pointers.

Gary Frederick

unread,
Feb 20, 2012, 6:21:18 AM2/20/12
to app-inventor-o...@googlegroups.com, Geo Massar

On Sunday, February 19, 2012 8:53:17 PM UTC-6, Big Daddy App wrote:
I will help in any way I can, Remember I am one of the new programmers.

I can think of several thing you can do to help.

This week I'm focusing on our Public servers that include the Windows server
and a project or two folks committed to working with us on.

Roger
What are you committing to do?

Gary
 

Gary Frederick

unread,
Feb 20, 2012, 6:25:30 AM2/20/12
to app-inventor-o...@googlegroups.com

On Sunday, February 19, 2012 10:46:25 PM UTC-6, Geo Massar wrote:
...

In fact, I am glad it is missed. Only the first two files are sufficient for the new tool, I believe..
...

The yail file would have probably been easier to get started with. The blk file has info about where the blocks are positioned we do not need to translate the blocks into another language.

No big loss...
I like XML

Gary

Gary Frederick

unread,
Feb 20, 2012, 6:30:01 AM2/20/12
to app-inventor-o...@googlegroups.com, Geo Massar

On Sunday, February 19, 2012 11:20:46 PM UTC-6, Sharon Perl wrote:
The yail file is the generated scheme code from some version of the blk file. It was never guaranteed to be up-to-date with the source in the latest version of the blk file.
 
So the other two files, blk and scm are guaranteed to be up-to-date ;-)
 
You can ignore it in any old source zips that you have.

I poked a bit and could not get it to be generated. No big loss.
 
I beileve it is only of interest during the build process, when it will be generated fresh from the blk and files.

Then again, if someone is playing with the code generated, it could be useful to see the yail generated.
 
Note that in the latest version of App Inventor with multiple screens there can be multiple scm and blk files, one set per screen.

More good info. 
Thanks Sharon.

Gary

Gary Frederick

unread,
Feb 20, 2012, 6:56:24 AM2/20/12
to app-inventor-o...@googlegroups.com, Geo Massar
Attached is a source file. The first screen has a button that opens the second screen. The second screen has a button that closes the second screen (and screen 1 is displayed).

I would like to have the Java source, both for the Java Bridge and as a simple Android project, that does the same thing. Then we can start looking at what it takes to generate code.

extra credit if someone does the HTML version ;-)

Gary
twoScreens.zip

Gary Frederick

unread,
Feb 20, 2012, 7:31:34 AM2/20/12
to app-inventor-o...@googlegroups.com, Geo Massar
Attached is the .blk file Screen2.blk

This is the opening XML for the Button1.Click
  <Block id="479" genus-name="Button-Click" >
  ...

the attribute 'genus-name tells us it is a Button-Click
one of the XML elements the Block element contains, the BlockConnector, has an attribute, con-block-id="483", that points to the block that is in the Button Click.

<Block id="483" genus-name="close-screen" has-focus="yes" >
...

The block with id 483 is a "close-screen".

Screen2.scm (also attached) includes this
  {"$Name":"Button1","$Type":"Button","$Version":"3","Uuid":"838450711","Text":"and back again"}
in the $Components list. That is enough to build the UI (more or less :-)) and the Uuid with the YoungAndroidUuidEntry in Screen2.blk has the info we need to associate blocks that start with Button1 in the <Label> with that part of the UI.

I think ;-)




Screen2.blk
Screen2.scm

Gary Frederick

unread,
Feb 20, 2012, 7:33:26 AM2/20/12
to app-inventor-o...@googlegroups.com, Geo Massar
And lang_def.dtd and save_format.dtd are in
  ...appinventor/blockslib/src/openblocks/yacodeblocks/support

Sharon Perl

unread,
Feb 20, 2012, 2:00:50 PM2/20/12
to Gary Frederick, app-inventor-o...@googlegroups.com, Geo Massar
One trick for seeing the generated scheme is to look in the Java console when the phone is connected. We print out the scheme code that is being sent to the REPL (Read-Eval-Print Loop) app on the phone that runs the code in connected mode. It will start with "Sending to phone: (process-repl-input".

--
You received this message because you are subscribed to the Google Groups "App Inventor Open Source Development" group.

Geo Massar

unread,
Feb 20, 2012, 5:10:39 PM2/20/12
to app-inventor-o...@googlegroups.com
We need a good name for the new tool that translates/interprets AI source to another source in various languages.

How about "Andpreter", an interpreting tool which is fluent in both AI and Java as well as XML, JSON, Scheme, Python and HTML for all Android compilers. Do you have a better name for the project?

The license should be the same as app-inventor-releases project since we might extract some pieces from the source repo to build the tool.

Our conversations all should be on this forum, App Inventor Open Source Development, We have already too many forums.

It should be the full collaborative efforts from Google, MIT and user community for the project. They have rich resources,

I am all open to suggestions.

Geo

Roger Belk

unread,
Feb 20, 2012, 5:54:01 PM2/20/12
to Geo Massar, app-inventor-o...@googlegroups.com

Geo Massar

unread,
Feb 20, 2012, 7:47:17 PM2/20/12
to Roger Belk, app-inventor-o...@googlegroups.com
geoadapter? nah!

Geo Massar

unread,
Feb 21, 2012, 12:26:00 AM2/21/12
to app-inventor-o...@googlegroups.com, Gary Frederick
In my earlier post, I said:
The blk file appears to be a set of Scheme expressions generated by Blocks Editor (block-building/programming tool.)

It is error. I looked at a wrong file, that's, a yail file which is generated Scheme. The blk file is really generated XML. My bad.

However, I sure am glad it is generated XML. Much easier to follow. Better yet, by converting XML source to fat-free JSON (we have a tool), it is much easier to understand. I will post an example soon.

Gary posted 7 sequenced messages this morning. One or two msgs, I will reply to.


Gary said:
The yail file would have probably been easier to get started with. The blk file has info about where the blocks are positioned we do not need to translate the blocks into another language.

No big loss...
I like XML

Easier to get started? I don't think so. I prefer XML to start first. Yes, the blk file has a lot of info for Blocks Editor to display blocks. However, it also has some info for logic coding part. Am I correct, Sharon?

During the process of interpreting, we simply ignore those block locations.

Downloaded and saved twoScreens.zip file for future work. Too early for now.

Furthermore, Gary said:
I would like to have the Java source, both for the Java Bridge and as a simple Android project, that does the same thing. Then we can start looking at what it takes to generate code.

We will do that during the early stage while building the interpreting tool.

Geo

Sharon Perl

unread,
Feb 21, 2012, 12:50:10 AM2/21/12
to Geo Massar, Gary Frederick, App Inventor Open Source Development

Yes, the blk file also represents all the program logic.

Geo Massar

unread,
Feb 21, 2012, 1:08:44 AM2/21/12
to Sharon Perl, App Inventor Open Source Development
Good to know. Thanks, Sharon.

Gary Frederick

unread,
Feb 21, 2012, 2:23:06 AM2/21/12
to app-inventor-o...@googlegroups.com

On Monday, February 20, 2012 4:10:39 PM UTC-6, Geo Massar wrote:
We need a good name for the new tool that translates/interprets AI source to another source in various languages.

How about "Andpreter", an interpreting tool which is fluent in both AI and Java as well as XML, JSON, Scheme, Python and HTML for all Android compilers. Do you have a better name for the project?

???
 >for all Android compilers
If it generates Java and XML, Java, Scheme, Python and HTML it is for way more than Android


The license should be the same as app-inventor-releases project since we might extract some pieces from the source repo to build the tool.

Good

Mark Friedman

unread,
Feb 21, 2012, 12:55:03 PM2/21/12
to Sharon Perl, Gary Frederick, app-inventor-o...@googlegroups.com, Geo Massar
You could also probably hack the build server to output the YAIL code that it generates.

-Mark

On Mon, Feb 20, 2012 at 11:00 AM, Sharon Perl <sha...@google.com> wrote:

Geo Massar

unread,
Feb 21, 2012, 4:29:42 PM2/21/12
to App Inventor Open Source Development
Another name for the new project: app-inventor-interpreter (AIpreter for short.) How does it sound to you?

Purpose: Building an educational tool to interpret AI source to Java source for new Java programmers.

License: the same as app-inventor-releases

The goals of the project
- The input to the tool: AI source in zipped file (blk/scm files)
- The output from the tool: Eclipse-importable source in zipped file.
- Selectable platforms for the output:
-   Java Bridge {with $define section)
-   Prototype (pure Java with or without XML file)
-   Anything else?
- Types of application for the tool:
-   Command-line standalone with optional switches
-   GUI standalone
-   Eclipse plugin 
- Cloned source of components from app-inventor-releases for the repo.
- Downloadable Java Bridge jar
- Any more goals?

Still open to suggestions.

Would appreciate your inputs. Thanks.

Geo

Sharon Perl

unread,
Feb 21, 2012, 4:35:41 PM2/21/12
to Geo Massar, App Inventor Open Source Development
My 2 cents: "interpret" doesn't quite sound like the right verb. Maybe "cross-compile", "retarget", or "translate"? 

Geo Massar

unread,
Feb 21, 2012, 5:08:31 PM2/21/12
to Sharon Perl, App Inventor Open Source Development
Sharon,

Thank you for your 2 cents. I need them. :-}

Cross-compile - nope. The tool is not a compiler. Eclipse is the one.
Retarget - maybe good choose.
Translate - maybe better choose.

How about export? The tool does the translating and exporting source for Eclipse IDE to compile.

Hmm... app-inventor-exporter or ai-exporter for short.

Geo

Sharon Perl

unread,
Feb 21, 2012, 5:13:49 PM2/21/12
to Geo Massar, App Inventor Open Source Development
So far, app-inventor-exporter is my favorite, I think :-)

Geo Massar

unread,
Feb 21, 2012, 5:27:05 PM2/21/12
to Sharon Perl, App Inventor Open Source Development
So be it! :-}

Geo

scottfromscott

unread,
Feb 22, 2012, 7:55:49 AM2/22/12
to app-inventor-o...@googlegroups.com
I am interested also, Geo.

Geo Massar

unread,
Feb 22, 2012, 11:48:37 PM2/22/12
to Scott Ferguson, App Inventor Open Source Development
Hi, Scott from Scott, LA

Thanks for your interest in the project.

How do you consider yourself regarding Java experience? The project is meant for everybody regardless how much experience. We all help  each other.

Jeff

On Wed, Feb 22, 2012 at 8:33 PM, Geo Massar <kaw...@gmail.com> wrote:
Hi, Gary...

Back from eye doctors (yes, plural). One for good eye and other for bad eye. The good eye is doing very well, much better than average. The bad one is hopeless. Need new medicine to keep it from getting worse. Sigh...

Visited Jeff-/Chris-owned project for their Java translation. Seem not much active. I don;t see any discussions regarding their work. Maybe you know something.

I, myself, would rather to have a new community-based project open to everybody and establish a relationship between new and pro programmers such that the new ones do some programming work under the pro's written guides, somewhat similar to school projects. That way, everybody is learning, even the pros themselves.

All I do now is to await Jeff's reply. Hope we could work together to finish the project.

Geo





On Wed, Feb 22, 2012 at 1:25 PM, Gary Frederick <gary.fr...@jsoft.com> wrote:
private email

On Wed, Feb 22, 2012 at 3:03 PM, Geo Massar <kaw...@gmail.com> wrote:
...
I am grateful that you have already started the project last year. I wasn't aware of the existing project. Nobody ever told me about it when I was "on the board."
Jeff's student had health issues and I was keeping it low key, taking my queues :-) from Jeff.

I am focused on the other things I mentioned in the other topic. I wanted to help get things going and that has happened. Let me know if you want something specific from me that I can do.

Gary


Reply all
Reply to author
Forward
0 new messages