Wiki

Clone wiki

cgml-compiler / quick_start

Quick start

Setup

Download CGML compiler and support libraries for target language from downloads page. Add support library to your project.

java -jar cgml-compiler-2.0.jar

Protocol for simple web chat.

Create folder with this structure.

+ .
|-+ source
  |-+ com
    |-+ example
|-+ generated
  |-+ java
  |-+ as3

Copy this code into source/com/example/client.cgml

% cgml.lang.basic

* void request
  @ string login
  @ string send-message

And this into source/com/example/server.cgml

% cgml.lang.basic
% cgml.lang.struct

* void response
  @ login-result login-result
  @ string new-user-here
  @ string user-leave-the-room
  @ message add-message
  
* void login-result
  @ void nick-name-is-busy
  @ slist.string ok # You are logged in. There list of users in the room.
  
! void message
  @ bool private
  @ string target
  @ color color
  @ string text
  
* void color
  @ void red
  @ void green
  @ void blue
  @ void yellow
  @ void black
  @ triple.byte rgb

Type in your terminal

java -jar cgml-compiler-2.0.jar -source source -java generated/java -as3 generated/as3

Have fun :)

Updated