Skip to content

Aincvy/langX

Repository files navigation

langX

It's a script language. I made it for quick developing.

It's in developing stage.

Features

  • Weak typing, interpreted script language.
  • Easy rules.
  • Bridge other languages library.
  • The last user have power to change the library's behavior.
  • No private keyword, field and variable are public.

Editor And Doc

Editor

Use Atom as editor.

langX-atom plugin, it's used for syntax highlighting, and it works in progress. And it do not support auto-complete.

Document

langX in Gitbook

Simple code example

// a.lx
// this is the comment.

// this is the function.
funa => {
	a = 1 ;
	funb();

	// build-in function.
	println("funa" + a);
}

funb => {
  println("funb: " + a);
  a = 101 ;
}

// call function
funa();

// b.lx

// declare class
Student {

  // class member
  name;
  age = 20 ;

  // class function
  a => { print("hello,a!\n");}

  printInfo => (a3){ print("name: " + name + "\n");  print("age: " + age + "\n" ); print("a3: " + a3 + "\n");}

}

// new a object
s2 = new Student();
s1 = s2;

// set class prop
s1.age = 10 ;
s1.name = "Mr.Ming";
b = s2.age;
c = s2.name;
/*print("b: " + b + "\n");
//print("c: " + c + "\n");  */

s1.a();
s1.printInfo("ahahahah~");

Screenshot

https://github.com/Aincvy/langX-atom#screenshot

Directory

  1. 3rd
    1. Simple notepad++ config files.
  2. cmake
    1. cmake search files. (**.cmake*)
  3. docs
    1. Document. (English and Chinese.)
  4. extern
    1. Lex and yacc files.
    2. Lex and yacc generated files.
  5. include
    1. Headers.
  6. source
    1. Sources.
  7. lib
    1. Extra libraries files.
    2. This will be deleted.
  8. mod
    1. Nothing
  9. modProjects
    1. langX mods
    2. core/mysql/python-bridge/redis/...
  10. rtlib
    1. Runtime library. (WIP)
    2. May all write by langX.
  11. scripts
    1. Test scripts.
    2. Example scripts.
  12. notImplementation
    1. Just ideas.

Compile and install

  1. Please read section Dependent first.

  2. Install flex,bison,log4cpp.

    1. Mac
      1. brew install flex
      2. brew install bison
      3. brew install log4cpp
    2. Debian
      1. Todo.
    3. Centos
      1. yum install flex-devel bison-devel
      2. Download and compile log4cpp.
  3. Install cmake.

  4. mkdir build && cd build
    cmake ..
    make
    sudo make install 
  5. Now, the simplest program is installed, you can use langX --version to test it.

  6. You can try to compile mods now.

Dependent

simple runable program

  • flex
  • yacc(bison)
  • log4cpp

lib core

  • Nothing

lib mysql

  • mysql-devel (mysql-connector-c)

lib python

  • python-devel

lib redis

  • hiredis

lib zip

  • zlib

lib json

  • cjson

Others

PR and Issue is welcome!