Send As SMS

2005-04-06

ideas on a new script language

The language should define a very basic lexical grammar.
  1. Lexical Block
    1. """ any string literal """ that is not escaped
    2. " string support escape "
    3. xml block (no prefix spaces)
    4. ( ) block
    5. [ ] block
    6. { } block
    7. other block is seperated by space, tab and cr/lf in token
    8. two seperator: , ; which cant used as part of token
  2. Data type definition
    1. string literal
    2. position(x y)
  3. core dialect
    1. class/field/method
    2. @var $var %var variable reference
  4. SQL dialect
    1. #sql(select * from table1 where field1 = "hello")
    2. #sql select * from table1 where field1 = @var;
  5. dialect
    1. in the core dialect, using #dialect(statement), each dialect is coded as #id object
like LISP but more free.

process flow:
source -> token tree ->(core dialect process) -> objects tree ->(other dialect process) object tree -> (till all precompile complete) -> executable object tree

simple code

class Demo {

function hello() {
prints "hello world";
}

function accessDB(){
%mytable = #sql ( select * from mytable where fid = @fid);
prints "name = $(mytable.fid)"
}

}

How does it works?

0 Comments:

张贴评论

<< Home