AHSoftware

Back to main project page

Project "Comal80 compiler syntax"

Development of the Comal80 syntax with examples of Comal80 source code. The Comal80 compiler / transpiler will be created with help of Comal80 code collected from the internet, and I will add Pascal like objects to the Comal80. I will not recreate a clone of the Comal80 from the 80s, but many commands are like old version from 1980s.

In the first many development versions of Comal80, I need to get help from Python and C++. In the future it would be great if I could create new versions of Comal80 with Comal80. My Comal80 will translate into Python and C++, and then the children can work with there Python and C++ version of there development project. From Python and C++ you will be able to create binary code for your device and operating system.

My syntax creation will try to get as much old 1980s code into my Comal80 project as I can find on the Internet. Then the missing Comal80 commands will borrow from Basic and Pascal. Then I will add Object Pascal like code for the object oriented development code added to this Comal80 project. Thru object classes I will add predefined classes with reduced functionality to everything from GUI, 3D graphics, video, MIDI, audio, network, encryption, and more. Children will learn to write all code in an text editor. No graphical elements to be moved around while write the Comal80 code. Children learn to write Comal80 code, Run Debug Test the code, and switch back to there Comal80 code.

Threads, half baked code from backend operating systems, libaries, frameworks will all be hidden away from children. If children wants more functionality, then they can work with the generated Python and C++ code later.

In the 1980s computers would barely nothing but write text on the screen, draw simple 2D graphics in a few colors, and make a beep in the speaker. Today computers can do much more. This is reflected with this Comal80 compiler. While simple Comal80 code with recreate the old limited days of what computers could to back then. Combined With object oriented programming will add all the functionality that computers can today.

Workflow by the child (and adults):
The child write the Comal80 code, and test the code while give the command "run".
The transpiler then transpile the Comal80 to "temporary intermediate development language.
Then Transpile the "temporary intermediate development language" to C++ and Pascal.
If an error happens. then the error is descriped to the child in the Comal80 IDE (Integreted Development Enviroment), typically a simple text editor.

My intermediate language is a combination of static objects, well defined variables, predefined modules and objects, easy syntax reading for humans. This should help make the next compilation to Python or C++ more easy and secure. There are NO focus on speed. All focus is on readability and comprehensibility. Children don't know how to write secure and safe code. So this transpilation can help with this task.

Have fun developing and programming no matter sex and age.



Old or removed code.
Not used in Comal80.

Normal code.
The code is already in "old" Comal80, and reused here

New code.
Typical this is my own code added

Description / headline

Old Basic syntax

Old Pascal syntax

Children language
Comal80 syntax

Compiler / transpiler generated intermediate code
Transpiled temporary intermediate syntax

Target 1 - generated from the intermediate code
Python syntax

Target 2 - generated from the intermediate code
C++ syntax

My hidden secret addon of objects that gives access to C libraries, plugins, bidirectional C and CPP interface to other development languages (this is NOT intended for use by children)


Don't exist

Don't exist

IMPORTEXTERNALADDON "library-name.cml" 
IMPORTEXTERNALADDON "library-name.h"
IMPORTEXTERNALADDON "library-name.hpp"

?

?

?

My addon of objects with access to Network, encrypted network, VPN, and more


Don't exist

Don't exist

?

?

?

?

My addon of object GUI wih widgets


Don't exist

Don't exist

?

?

?

?

My addon of objects wih Multimedia, Audio, Video, MIDI, Streaming, Virtual Music instruments and effects


Don't exist

Don't exist

?

?

?

?

My addon of objects for webserver, webclient, text chat, audio and video chat / meeting


Don't exist

Don't exist

?

?

?

?

My addon of objects for 2D and 3D graphics, animation, shading, light settings, games development


Don't exist

Don't exist

?

?

?

?

My addon of objects for mathematics and physics


Don't exist

Don't exist

?

?

?

?

Source code documentation, description and other text. This is part of the source code, but not part of the application


REM Old basic code

(* This is an old style comment *)  
{  This is a Turbo Pascal comment }  
// This is a Delphi comment. 
//   All is ignored till the end of the line.

// Comal80 is great for children

?

?

?

Print text on text screen


PRINT "Hello world"

write ("Comal80 is great");
writeLn ("Hello world");

PRINT "Hello world"

?

?

?

If then condition

?

?


IF condition THEN
PRINT "Comal80 is fun"
... more instructions ...
ENDIF

?

?

?

Loops

?

?


FOR number:= 1 TO 1000 STEP 1 DO
PRINT number
... more instructions ...
NEXT number

?

?

?

CASE

?

?


DIM myText$ OF 80
myText$ = "A"
CASE myText$ OF
WHEN "A"
PRINT "Comal80 for children"
WHEN "B"
PRINT "Comal80 is easy to learn"
OTHERWISE
PRINT "Back to the 1980s"
ENDCASE

?

?

?

DIM

?

?


DIM myText$ OF 80

?

?

?

VAR Define variable name and type. Borrowed from Pascal to Comal80


Don't exist

VAR s : String;

VAR s : String

?

?

?

Data pre entered as a list of bytes

?

?


DATA 10,20,30,40

?

?

?

Set application type
(Hidden application engine that the child can write code and communate with)
0 = Default plugin functions from other development languages
1 = Default Color Textmode
2 = Default simple graphics mode
3 = GUI with menu and widgets
4 = LOGO grapphics
5 = 3D graphics, sound, 3D modeling, and game engine
6 = HP48 calculator GUI with math. functionality and graphics
7 = Virtual synthesizer modeling and playing/using
8 = Virtual Electronics board

This funtion close all output windows, and open the new selected window. Already running application engines are closed, and new one are started.


Don't exist

Don't exist

SETAPPTYPE := 1

?

?

?

Change graphics mode (text, 2d graphics, 3d graphics, video, single window, dialogbox with widgets).

This function change the graphics mode in already existing window.


Don't exist

Don't exist

?

?

?

?

Set application transpiling target
0 = Transpile to intermediate code
1 = Transpile to Python
3 = Transpile to C++
4 = Transpile to WebAsm


Don't exist

Don't exist

SETCOMPILETARGET := 1

?

?

?

Repeat


a = 0
Repeat
	a = a + 1
Until a > 10

program repeatUntilLoop;
var a : integer;
begin
	a := 0;
	repeat
	  a := a + 1;
	until a > 10;
end

A := 0
REPEAT
	A := A + 1
UNTIL A > 10

tmpobj.variable.init(A, 0)
tmpobj.command.repeat
	tmpobj.variable.set(A, tmpobj.variable.get(A) + 1)
tmpobj.command.until(tmpobj.variable.get(A) > 10)	

A = 0
while A <= 10:
	A = A + 1

int A = 0;
do
{
	A = A + 1;
} while {A <= 10};

Request ending or stopping the running application

?

?


END

?

?

?

Input user text from text terminal (text mode GUI)

?

?


INPUT U$
PRINT "You entered: "
PRINT U$

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

Removed from my Comal80 version

All Goto line number are removed. Line numbers for every Comal80 line are removed also. This is done because it makes a very bad programming behavior, and very outdated and lowlevel use case. The use of labels and goto label is also removed. Please use newer methods for development.

Links

Links

Links

Links

Links

Open Source Initiative


Linux Foundation


Linux Kernel


GNU


Distrowatch


Free and Open Source Software



Fedora project sponsored by Red Hat


Software Freedom Conservancy