Coder Social home page Coder Social logo

fa's Introduction

fa

fa语言编译器实现。一款专注于元编程的编程语言,目标是尽可能简化复杂的框架调用,让函数尽可能简单易懂

[WIP] 编译器存在较大修改,暂不可用
qq交流群:1018390466 欢迎一起讨论语法/实现/轮子

老版本C++及C#实现已在 Release 备份

主要特性

  • 可以很方便的在代码里嵌入元代码,改变实现。示例代码:
class Program {
    public static void Meta (mut Dictionary<string, ClassBlock> _classes) {
        var _stmt = stmt Console.WriteLine ("hello world!")
        _classes ["Program"]?.funcs["Main"]?.body_codes.Add (_stmt)
    }
    
    public static void Main () {
    }
}
  • 语句加入 calc 关键字即可将代码标记为元代码,编译期运行。示例代码:
class Program {
    public static void Main () {
        var compile_time = calc DateTime.Now()
        Console.WriteLine ("Compile Time: {compile_time}")
    }
}

fa's People

Contributors

adorableparker avatar cubik65536 avatar cy6er7um avatar fawdlstty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fa's Issues

【语法特性】关于向外传导可空值的单目运算符

前置信息:

fa语言采用单目运算符 ? 强制转可空数据为不可空数据类型,并在数据为空时函数自动 return,示例:

int? func () {
    int? n = ...;
    int t = n? + 4; // 此处当n为null时return并传递错误;否则t为n的值+4
}

向外传导:

我们需要一种新的单目运算符,用于向外传导可空类型。当调用函数时,假如参数为空,那么将函数返回结果变为可空类型,示例:

int func (int a); // 待调用函数

// 我们假设运算符为 `¿`
int? i = ...;
int? n = func (i¿); // 此处改func返回值类型为可空类型,当i为空时,传递错误给n,不调用函数

待确认向外传导空值的单目运算符符号

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.