forGL Information in GitHub

forGL repository is available.

Archive includes info needed to be dangerous with forGL…
Sources, Docs, Build info, example Dictionaries, Haxe US Presentation, more sources, OH My !

Presentation Outline @ Haxe 2019 US in May
I have been approved to present the forGL application in May at Seattle.
Expected duration is close to 1 hour with
Demonstration, Background, answer Questions, then repeat until time runs out.

Thanks to the Haxe Foundation, HaxeTeam and Haxe Forum Members I have made enough of (a nuisance … er) progress to be dangerous with a presentation.

Acknowledgements:
Gerard W. Horgan, Willem van Rijk and others that helped create / sell Amber language / IDE, Amber Software (USA, Netherlands and Deutschland), Cyware – companies not in business now (found on Wayback site).

forGL application (open source, MIT) is to help people to do computer programming that do not have previous experience either with programming or understand English.
If you can type in your own language and know how to use a Calculator program then you can start using forGL. Intended platforms are
phones, smart phones, tablets, laptops, desktops, servers, etc.

forGL repository on GitHub. I aim to publish working code by end of April 2019.

Presentation Details

forGL Demonstration examples
Options that User / Programmer can choose by command line (TODO) or interactively
Run automated Tests in one window while Editing / Running / Debugging in another TODO
Showing Dictionary contents
Editing Words (Nouns, Verbs, alias to any Operator) in a Dictionary
Verb shown after Parsing / Resolving
Verb running manually: output of Show command, Data, Operator and Noun stacks
Verb running Automatically. Options about Speed and stack Details shown
Exporting a Verb to Haxe with comments as given in User’s language

forGL Background Ideas
simplified Natural Language(s), not doing Natural Language Processing here
Nearly any syntax style will work (infix, prefix, postfix). You can also mix different Words from different languages in the same Verb. You can define words in languages from Games, Movies, Books, Stories, Myths, Legends, etc. and then program with them.
Dictionary analogy only about 100 Word definitions needed to start to be productive
European languages supported now (proof of concept) i18n is a TODO.

forGL Questions & Answers
Up to you…

5 Screen Shots Text mode in Windows (GUI TODO), please read top to bottom

Summary
Many details and features to add to forGL have been posted here in Haxe Community.

Creating and using forGL has given me new perspectives about what computer programming means and perhaps more interesting about how people learn programming as a way to solve problems.
Have Fun!

It’s greek to me

also supported right now …

as in actually running Code (Verbs) using Data (Nouns, named as you wish) now in languages :
French, German, Spanish, Italian

these are just the simple examples I have played with.

I believe that perhaps over half of the world’s languages (because they read Left to Right, like Greek) would just work right now. Other languages such as from Books, Movies, Myths, etc. would also likely just work as long as they read Left to Right and can be expressed in UTF8.

English example of Factorial verb
into L. 1. into p. 1 into i. while ( i <= L ){ p * i into p. i + 1 into i.} p.

German example of Faktorial verb
geht L. 1. geht p. 1 geht i. Während ( i <= L ){ p * i geht p. i + 1 geht i } p.

Both of these Verbs give the correct results because they both have the exact same internal representation to the forGL Interpreter.

Both of these use the Concatenative paradigm style.
Now working on Procedural paradigm style Faktorial( 5 ) instead of 5 Faktorial to better support the Export As Code ( to Haxe ! ) feature with as least some idea that exported code is actually working OK.

forGL Defects:
Messages: Info, Warnings & Errors limited to English (i18n happening perhaps end of May)
Many other Defects and TO DO items found in forGL/Docs/Maintainers directory

Hey RMax, could you explain in simple terms what’s the relation this has with Haxe?

1 Like
  1. We can write word definitions in a dictionary in our own language(s)
    Verbs are code.
    Nouns are data.
    Operators are like Math.
    Punctuation is itself.

  2. Export As Code (partially done now) is an option you can use.
    You run the forGL Interpreter.
    forGL will rearrange / refactor your own code (definitions of Verbs & Nouns …)
    into actual working Haxe code (real soon now).

So Haxe is very important for 2 major reasons with forGL:
1 Used to implement most of forGL
2 As a target source code language of forGL
exactly like Haxe has target source languages like C++

It is major reason #2 that makes forGL unique with respect to Haxe.
I do not know of any other application / framework that will generate Haxe code.

We may say that the Haxe compiler and Haxe macros and so on will generate Haxe and modify it inside the Haxe compiler environment.

I am saying there is now a 3rd party application that will very soon generate Haxe code.
Not within the Haxe language Compiler environment but from within a simplified Natural Language environment.

I also see a day when other programming languages are forGL targets:
Rust, Haskell, Prolog are a few of what would be fun to have…
Thanks for your question. Hope this helps!

How is that less complicated that just a normal factorial function? I think thats what im missing. Fine, the “while” and “into” are in native language, but the rest of it simply isnt:

into L. 1. into p. 1 into i - is pretty esoteric, regardless if you replace “into” with “cats” - maybe im missing something?

The esoteric you see is may actually be easier for non Programmers.
Example was Concatenative.
into L. 1. into p. 1 into i. while ( i <= L ){ p * i into p. i + 1 into i.} p.

Better (Procedural) example for experienced programmers would be:

 Factorial( L )
{
    p from 1.
    i from 1.
    while ( i <= L )
    {
       p from p * i.
       i from I + 1.
    }
    return p.
}

// This is about the easy 80% of what Export As Code would do.
// The other 20% is Haxe needs being correct. Class, var, etc.

It uses From keyword to Declare the direction of transfer during an Assignment.
Just like Into keyword was used earlier when the direction was going from Left to Right.

Into and From are both forGL keywords / concepts that capture relationships used in common language. Perhaps we can think of them as Declarative in nature. They specify WHAT direction and WHAT gets changed without needing to detail HOW to make the change.

Agreed that was Poor example from Imperative (How to do) programming point of view. Not much complexity removed. My mistake.

I am modestly happy because even with this poor example forGL forces LESS thinking of Problem / Solution away from a User/Programmer’s own Natural Language.

I completely agree that a better example is more Declarative (What to do).

I have intentions of doing much more support of Declarative style.
Many existing proprietary 4GL have reserved keywords like List for example.
List will do a search in 1 or more databases and then return results not just in ragged text fragments but formatted nicely in a Table presentation. So no extra work needed by a 4GL User.

Functional programming is much more Declarative and that is a future direction of forGL and also lots of 3GL languages now, Java, JavaScript, C++, Python, (Haxe?) to name a few.

We have SQL as example of Declarative style Domain Specific Language.
I would assert that a LOT of Graphics & Web programming is Declarative also.
We declare What/Where to put text or Graphics or some other visible thing but the How details are handled by HW or OS to HW support or as a cross platform API library like OpenGL.

I want to have a Query feature of forGL that you enter a search like Factor
and then results come back like
Factorial
Test_Factorial uses Factorial

but this is really just a search of the Dictionary nearly the same as how IDE now search through files.

So now forGL will only offer a little support for more Declarative approach.

Any suggestions about how to make forGL more effective to help with learning computer programming would be very much appreciated. But as we know from experience programming carries a lot of Complexity background. As we move from a high level talk about WHAT we want we seem to quickly get to HOW it takes THOUSANDS of LINES in HAXE to have forGL just do a less than great job right now. AH ! The IRONY of it all …
And forGL needs to first “crawl” before it “walks”. I do declare !

How would you express this in 4GL (out of interest):

while (i < 10) {
	if (i % 2 == 0) {
		trace("even");
	} else {
		trace("odd");
	}
	i++;
}

No bold explanations… how would that look in an NL neutral programming language?

Summary:
I think you are really asking about what is the recommended forGL syntax ?
forGL does Not recommend a single syntax.
There is No forGL Way.
That is both an advantage and an obligation of forGL.
Advantage as it allows our forGL Users to express their ideas as they wish.
Obligation to be sure that more syntax combinations are supported correctly / logically / fairly.

Minimal change would be
replace trace with show
replace i++ with i = i + 1 (have reserved notation for ++ increment but not implemented yet)
replace ; with . (period) perhaps.
The given example just uses 1 statement per block.
forGL inference allows not having to add punctuation to end a statement if only 1.

We could keep the same 1 statement per line style as you give

while ( i < 10 ) {
    if ( i % 2 == 0 ) {
        "even" show 
    } else { 
        "odd" show 
    } 
    i + 1 into i    // OR  i + 1 =: i  OR  i from i + 1  OR  i := i + 1
}

or
perhaps all on 1 line :

while ( i < 10 ) { if ( i % 2 == 0 ) { "even" show } else { "odd" show } i + 1 into i }

Or perhaps a style that uses fewer lines than we start with but more than 1.

Because forGL does not limit how many statements per line, the formatting is really up to the User.
The 1 statement per line is more a continuation of the “punch card days” and now it is a limit more due to how Debuggers work than a real problem with most compilers or interpreters.

forGL is not intended to impose any single way of expression of Problems or Solutions but rather provide an application and environment where anyone can experiment with various ways of thinking about programming and then test their ideas. And then the really Cool part is to transpile to Haxe and then transpile to a dozen other programming languages.

So one way of thinking about the forGL environment is that it allows a way to express programming ideas that looks more like a pseudo programming language syntax than most others. But I think it is effective because it gives immediate feedback as part of the very flexible syntax.

“how would that look in an NL neutral programming language?”
Perhaps in one way I fail to give you a good answer. As of now I am not confident that we should look for a singular solution.

Perhaps the best I may say is: Use whatever style you like.
One thing I have learned after working on forGL is that code style is not very important.
Ease of Reading and Understanding are very important.

Because the forGL roadmap will be adding more programming paradigms this year, the intention is not to go to wildly different syntax but to try to follow syntax and semantic conventions related to the various paradigms. Concatenative was perhaps a poor choice to start with but the forGL Interpreter is already Stack based and I can’t think of any general purpose CPU architecture / instruction set that does Not have some kind of Stack segment & Stack related Registers.

So I thought a gentle introduction to new programmers about the Stack concept and making the Data, Operator and Noun Stacks be a visible part of forGL would help. The view of the Stacks can also be limited to just the Data stack or none at all. There is also a simple feature that waits a short period of Time between Automated steps. Which gives the appearance of a kind of Stack Animation.

Thanks Ian for the thoughtful question.

1 Like

I can conclude that the repo readme clearly demonstrates 4GL doesn’t care how things are written. But the fact is that i stared at the page for two minutes or so before i realize i have actually read nothing.

Anyway, are 4GL users supposed to write a parser/interpreter themselves otherwise how can 4GL “has no defined syntax”?

The forGL readme.md has added explanations and screen shots.

The previous readme.md was more of a Marketing blurb than something programmers would like. It was a poor and awful summary example of all the work I did on forGL. My sincere apology for wasting your time.

The readme.md still needs more editing but for now I hope this is Good Enough.
Also I am sure there are some big holes in other places of forGL documents & code.

I am hoping you see that there is no need to have forGL Users write parsers/interpreters.
forGL interpreter itself has very flexible syntax support, so flexible it sometimes seems like no syntax at all. But because of the Concatenative approach with a stack based interpreter you can arrange terms in forGL statements mostly any way you want. This is a Must Have feature to allow support of various simplified Natural Languages with 6 different combinations of Subject Verb Object (SVO) parts of speech (or SOV or …). And like a lot of interpreters, forGL resolves various terms and then runs them. I swear that forGL really does call Haxe code helpers internally, honest! To get to the point of calling the Haxe helpers, forGL will hold off doing a statement until all the needed information is available and then rearrange terms to Haxe form as needed.

forGL really is a mix of (simplified) NL and Programming and that is perhaps hard for experienced programmers to see. If my words do not help please try out forGL.

Thanks Kevin for letting me know when I mess up!

So you mean 4GL has unrestrictive syntax. So one can achieve the same effect with a wide range of different syntaxes and all the code examples in the thread works out of the box?

All the code examples work, not trying to sell Vaporware.

Also there is about a dozen examples embedded as comments in Run.hx
search for: test_def around line 2300

All the commented out examples work.
It is a code Regression Defect if they do not.
The most recent instance that actually appears as the Test Verb may Not work.

NOW
forGL has the potential to imitate a fairly wide variety of SYNTAX.
There are 2 modest changes below that I think would make the potential a better experience.
Note that 1 change adds a syntax key word and both changes add some Semantic support.

After forGL implemented the basic support for the 6 combinations of SOV, it became clear that the majority of popular programming languages syntax are close to a subset.

Some Time SOON
So also to what was asserted before about forGL, we may assert now that with a modest amount of editing / adding words to a forGL dictionary that the basic simple syntax of different programming languages may be supported with a runtime interpreter. This would also include various examples of pseudo code from Algorithm books, classes, papers, etc.

There would be a new Option like : Use strict types (y/n) ?
That would need some internal changes to forGL to correctly support.

Another useful Option is like : Allow invariant Nouns (y/n) ?
Which would also need some internal changes.

The 2 above along with what forGL already does would (I think now) support several simple examples written in various programming languages, Haxe included.

Please understand that my view now of simple examples means REALLY simple:
forGL now supports If, then, while
And that is it for Branching logic.
Of course there is intention to support several more common Branch key words.

Warning:
Just because forGL can accept various Syntax does not automatically mean that the Semantics related to the Syntax are correctly supported. Time and lots of Testing will tell.

Thanks Kevin for keeping me honest!