Read the documentation in french : Documentation française

This is the first documentation of CodeCommander.
The first documentation is written in English, but not all documentation will be written in English, but in french too.
You will find here the Road Map.
The next page you can view is written in french, Organisation du projet

New functions will improve the compiler : Do multiple threads in parallel and Conversion

The CodeCommander tool is easy to use. First, you need to write your first source code in text.
In CodeCommander, text or sample text is not parsed nor syntax highlighted. Then, you can write any text.

The first thing to know about text, that's your source code. For example, a text example is :

for(int i=0; i < 10; ++i)
{
sum += i;
}

This was a text example.

Now, you can edit your source code and want to customize this source code in order to parameter it.
You select with your mouse a sample of the text and you click with the right button on the selected text.
A box appears, and you can choice the change.

The first change you can make with CodeCommander is a mark, or a dictionary variable. Choice dictionary variable:

for(int <myVar>=0; <myVar> < 10; ++<myVar>)
{
<mySum> += <myVar>;
}

Now, here i have modified all text "i" and "sum" by myVar and mySum.

When i want to generate my new source code, a new window will appear and offer to me to type the content of the tips, hence the variables myVar and mySum.

About the titles
It's badly to only display the variable name. You should write a display text for each variable you create.
Then, for each variable you define in CodeCommander, you need to write a display text. In order to do this, you will have an asterik near of the variable name and by clicking into it, you are invited to write the display text of the variable. You shall write "Name of the index variable" for myVar and then "Name of the sum variable" for mySum.
Now, when you compile and test your source code, the new window shows the display text of the variables. And you can write "i" for myVar and "sum" for mySum.

There is no validation control into the window compiler. You can write any text into the text boxes. But, it's likely reasonable to validate against an expression.
Then, for convenience, you have several types and regular expressions you can use to validate the entries when the user compiles your source code :
  1. text
  2. integer or real
  3. boolean
  4. enumeration

About the window compiling
The window compiling is a window that comes in all dictionary variables you defined in the programming language of the compiler.
First, you can define a single variable: it's the couple name and value.
But, you can also define a tabular and their fields. In order to do this, you can choice a tabular dictionary variable : for example, <properties[0].myVar>.
You can insert any expression between the brackets of this statement. But, the expression can only contains scope variables.

Scope variables

What are scope variables ?
Scope variables are some variables related to the compiler. There are only available in the context of the compiler and not viewed by the user.
Scope variables are defined in :
  1. global program
  2. local in a process

What is a Process ?
A process is simply a sub-routine that you call from any other processes (also the global process) in order to go through the sub-routine.
Then, if you name a scope variable at a moment, the variable is known by all sub-processes you can call. When an ancestor variable has changed during a process, changes are known beyond the end of process. When you back to the top-most process, the variable is set to the last value.


Loops
The next change you can do is to add a condition. For this, it's a little picture to know about a branch out in a turing machine.

When you add a condition statement, first, you have to write an expression which returns true or false. Then, you have to declare two branch out labels. One for the true, and one another for the false.

For example, a condition will be if(size > 0; start; end).
start is the true label. When the expression returns true, the compiler goes to the true label.
end is the false label. When the expression returns false, the compiler goes to the false label.

If one label doesn't exist, the compiler fails during execution when it wants to move to that label.
Also, labels are never checked during the loading pass.
It's ensures that if your expression always returns true, you can type a fake label into the false condition statement. Then, you don't need an automatic "go to" statement. Use a condition instead of.

Using a condition is relevant when you would like to create a loop.

Here there is a loop:

<i = 0>
<start:>
Hello world

<i=i+1>
<if(i<10;start;end)>
<end:>

Templates
It's not only difficult to write all the loops among your customization development. It's very fastidious too.
Then, to simplify the usual case of loops, I have defined a new statement in the compiler : a template.
A template has a name and a path. A path is used when you want to write a template for multiple programming languages. The couple path and name must be unique for identifying your template for a call.

A template can include some named parameters. A parameter is a name associated with a value like :
  • any expression including additions, comparisons and so on,
  • a simple alphanumeric character chain,
  • a name of a variable existing in the scope and also a new variable name within a new process.

The big trip of a template is : It is an identity replacement of the named parameter with the value given at the moment of a call template. The transformation of a template is exactly similar to a replacement string.

I'm explaining that concept here :
  1. the template implementation is its responsibility to indicate the named parameter where it's usable.
  2. the name of a variable must replaced at the right places : an assignment statement or an expression.

Example:
<template path="/" name="loop">
<params>
<param name="counter"/>
</params>
<$counter = 0>
<start:>
Hello world
<$counter=$counter+1>
<if($counter<10;start;end)>
<end:>
</template>

As you call that template, the defined $counter variable as parameter will be set to i.

A template can also include coding. What is a coding in CodeCommander ?
A coding is simply a callback. Maybe, i should have given the name callback instead of coding.
But, a callback is very different than a coding because coding is not a programming paradigm.
When you want to execute some statements during the template execution that is not specific to the template but is specific to the caller, then use a coding.

Example:

<template path="/Languages/C#" name="Get" parameters="type, name">
public $type $name {
get {
<handler name="body">
}
}
<end template>

<use template name="/Languages/C#/Get" params="int, Count">
<coding name="body">
return this.Items.Count;
<end coding>
<end use template>

Another example of a template (with a loop) :

<template path="/Generic" name="For" parameters="name, until">
<i$name = 0>
<start$name:>
<handler name="say_it">

<i$name=i$name+1>
<if(i$name<$until;start;end)>
<end$name:>
<end template>

<use template name="/Generic/For" params="test, 10">
<coding name="say_it">
Hello World

<end coding>
<end use template>

Others
There are three others statements which I have explored : skeleton, include and package.

Skeleton
Well, when you write a source code in C#, for example, you have to write somethings like using, namespace, class name and functions. Then, there is a skeleton in C#. All programming languages need requirements to compile or execute properly.
Now, with CodeCommander, you can define first a skeleton and add injectors. Injectors allow you to insert something else in the skeleton during the generation of your source code.
With that functionality, you can use a skeleton written before and personalize it.

A skeleton is registered as a process. You need multiples skeletons. In fact, when you develop a software, you have to think about "who is calling my method ?" and "what does it ?". Now, you can write in the same file the method call and the implementation. It's more cognitive. The generation will write the method call in a specific file and implementation further.

Include
You have a file and a dictionary. The file contains what is written and the dictionary contains directives and values. This statement allows to name a file and make values in the dictionary.

Project
A project is a set of files which are running in a current project name context. A project is a statement with a name printed with a button to define a map between a dictionary project and all dictionaries per files. A dictionary project defines some new names and map these names around each strings and arrays in all dictionaries per files, each either to set else to get.

Package
A package contains files associated with a programming language. Using a package is the same that using a language. You are specifying the programming language in what you want generate it. Files are generated and you can personalize it in order to write your specific software.
Else, a package can be an entire software. You generate it and you customize it with your preferred IDE or else with CodeCommander.

Last edited Aug 28, 2014 at 12:11 PM by skercrow, version 37