PuqiAR da1a8e04de v0.4.3-alpha
[Fix] 函数调用时参数类型求值使用错误作用域的问题
[Fix] 结构体定义中不可以使用自身类型的bug
[Fix] import导致的重定义bug
[Impl] Parser的precedence调整

[Feat] 支持运算符重载, impl Operator for xxx {} 具体见 lang.fig中解释
[Feat] 新增标准库 std.test
[Feat] 新增内置函数 type,接收一个参数,返回该参数的类型(value.type改名value._type)
        推荐使用该函数替换 value._type
[Feat] 新增转换运算符 as,转换失败时抛出TypeError,支持任意类型到String、部分类型到Int, Double等等转换
        TypeError实现了Error interface,可被用户catch
        推荐使用该feat或与std.value标准库结合
[Feat] 抛出实现Error interface的错误现在会有不一样的log
[Feat] import增加cache(ast + source lines),但import一个module每次会得到不同对象而不是复用,请注意
2026-02-04 19:12:18 +08:00
2026-01-04 14:01:06 +08:00
2026-02-01 13:59:20 +08:00
2026-02-04 19:12:18 +08:00
2026-01-04 00:51:11 +08:00
2026-02-04 19:12:18 +08:00
2026-01-01 16:38:21 +08:00
2025-12-19 20:38:40 +08:00
2025-12-19 20:38:40 +08:00
2025-12-20 21:54:09 +08:00
2026-02-01 13:59:20 +08:00
2026-02-01 13:59:20 +08:00

Fig Language - A Modern Scripting Language

Fig-Gitea Recommend view on Gitea Endpoint

简体中文

Fig is a dynamically strongly typed programming language designed for clarity, safety, and modern development practices. With features inspired by Go, Rust, and JavaScript, Fig aims to provide a productive development experience while maintaining strong type safety.

LanguageTutorial(zh_CN)

Features

🚀 Core Language Features

  • Dynamic typing with type inference - Strong typing with minimal annotations
  • Modern control flow - Full for loop support with proper scoping
  • First-class functions - Lambda expressions and closures
  • Rich data structures - Structs, lists, maps, and tuples
  • Memory safety - No null pointer exceptions, automatic memory management

🔧 Technical Highlights

  • Three-level scoping for loops - Proper variable isolation in iterations
  • Smart semicolon handling - Flexible statement termination with RAII guards
  • Comprehensive error handling - Detailed error messages with source locations
  • Clean C++ implementation - Modern C++23 with RAII and smart pointers

🔧 Install

Installation

Prerequisites

Xmake version 3.0.0 or higher must be installed on your system.

Build Instructions

  1. Clone the repository:
git clone https://github.com/PuqiAR/Fig.git
  1. Navigate to the project directory:
cd Fig
  1. Build the project:
xmake build Fig
  1. Run the program:
xmake run Fig [file]

Replace [file] with the path to your input file.

Language Philosophy

Fig is designed around several core principles:

Clarity over cleverness - Code should be readable first

Safety by default - Prevent common errors at compile time

Modern ergonomics - Developer experience matters

Gradual learning - Simple to start, powerful when needed

Performance Summary

Version: 0.4.2-alpha (Tree-walker Interpreter)
Test Hardware: i5-13490F, Windows 11

Execution Times for Fibonacci(30):

  • Naive Recursion: 11.72s
  • Memoization: 0.93ms (12,600× faster)
  • Iteration: 0.37ms (31,300× faster)
  • Tail Recursion: 0.40ms (29,200× faster)

Visual Comparison:

Naive Recursion  : ████████████████████████████████████████ 11.72s
Memoization      : ▉ 0.93ms
Iteration        : ▍ 0.37ms
Tail Recursion   : ▎ 0.40ms

Key Insight: Algorithm choice dominates performance in this tree-walker implementation.

Detailed Reports: English | 中文

Language Documents

see ./docs/en_US/...

We're looking for translators to help translate our project and make it accessible to more language communities.

Description
The Fig Programming Language
Readme MIT 2.5 MiB
Languages
C++ 98.6%
Python 0.7%
Lua 0.3%
Dockerfile 0.2%