CL – Common Language (ComLang)

Keep it simple stupid programming language

The Problem with Computer Languages - (Zed A. Shaw - The Web Will Die When OOP Dies)

Zed A. Shaw - The Web Will Die When OOP Dies from Web Rebels Conference

More to come.

You are welcome to join the development team and create a brand new computer programming language! Just register at launchpad.net and tell me your Launchpad ID / Name / E-Mail.
https://launchpad.net/cl

 

Example - hello.cl

---------------------------------------------------------
// hello.cl - CL - Common Language ComLang source code

version

var-int answer = 99;

while ( answer != 0 ) {
  ""
  "-----------------------------------------"
  "Menu (enter a number): "
  "Primitives"
  " 1 - STRING"
  " 2 - PEEK & POKE"
  " 8 - flat to CSV"
  " 9 - LOGO like plotting"
  " 10 - Standard C code"
  " 0 - EXIT"
  beep
  input-int answer 0 20
  print "You entered: "
  echoln answer

  switch(answer) {
    case 0:
      "Bye!"
      end
      break;

    case 1:
      "== STRING"
      {
      "-- dupl"
      string myStr1 = dupl "Abc" 14
      echoln myStr1

      "-- reverse" ""
      string myStr = reverse "Test Reverse."
      echoln myStr

      "-- len"
      len myStr
      ""
      len "myStr"
      ""
      print "What's your name? "
      input-str n
      print "Hello "
      echo n
      println "."
      }
      break;

    case 2:
      poke 0 65
      poke 1 66
      poke 2 102
      peek 0
      peek 1
      peek 2
      peek 3
      peek 4
      dump_poke_field
      break;

    case 8:
      read-flat-to-csv("dataflat.txt", "4,10,40")
      break;

    case 10:
      for (int counter=0; counter<=100; counter++) {
        printf("%d ", counter);
      }
      break;
  }

}
end
---------------------------------------
----------------
"Hello World."
println
println "Text with newline at the end"
print "The length of the string is: "
len "abcdefg"
println

a = 0:9
a

b = 1:10
b

c = -5:5
c

// -- You can use just C as before
for (int i=0; i<=10; i++) {
 printf("%d", i);
}
println
readcsv("data.csv")

Runtime

$ bash ./cl.sh hello.cl
Hello World.
Text with newline at the end
The length of the string is: 7
0 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
-5 -4 -3 -2 -1 0 1 2 3 4 
 5 
012345678910
Währung Kurs
EUR 1.50
CHF 1.00
DOL 0.90

How it works

1. Pre Pre-Processing with UNIX/Linux SED

2. CPP PreProcessing generates pure C/C++

3. Compile

4. Run

read-flat-to-csv("dataflat.txt", "4,10,40")

Reads a flat file with fixed data positions and create a CSV.

 

Helpful?

Schreiben Sie einen Kommentar

Ihre E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Warenkorb
Scroll to Top