Toc

Toc 是一个使用 TypeScript 类型系统实现的 C 风格语言解释器,支持动态类型、变量、表达式、控制语句和函数闭包等特性。

Check out Toc on CurateClick

• Copy the embed code to showcase this product on your website

• Share on X to spread the word about this amazing tool

两年前学习 TypeScript 类型体操时,个人的终极体操,并编写了介绍长文给初学者:类型体操之实现一个类C风格语言的解释器下面是实现效果演示的动图:demo实现的语言叫 Toc (点击在线体验). 它是 C 风格语法,接近 js。动态类型,基础类型有数字、布尔、字符串和 null,支持变量,表达式,块语句,if-else 条件语句,for 循环语句,函数。且函数是一等公民,可以传入传出,支持闭包。更详细的语法,可以参见 Toc Grammar Spec。文章比较长,主要介绍了:1. ts 的类型系统是怎样的函数式语言?2. 如何实现 Toc 解释器?文章介绍的很详细,其中为了照顾没有编译器基础的,还写了一个 ts 版本(不使用类型系统,直接使用 ts 语言,额,也可以说用 js 实现的)的做对照。

Latest Weekly Picks

make.ink favicon
Weekly Pick

Your AI tattoo generator for pro-grade concepts

Leo Wade
sellfy.com favicon
Weekly Pick

A code-free online store builder to turn views into revenue. Sell digital products, subscriptions, and merch, without fees or hassle.

Maris
www.videotoblog.ai favicon
Weekly Pick

Convert videos into awesome blog posts.

Video To Blog
www.sellerpic.ai favicon
Weekly Pick

SellerPic is the all-in-one AI design platform for e-commerce

SellerPic
fastimage.ai favicon
Weekly Pick

Fast Image AI instantly transforms your photos into stunning styles like Ghibli, Sketch, and Pixar. Effortlessly control image elements and create amazing effects with just one click.

Fast AI Team
linkedinpro.daisy.so favicon
Weekly Pick

AI-powered tool that transforms casual photos into professional LinkedIn headshots instantly. No photographer needed—just upload and download.

Gabriel
crevas.ai favicon
Weekly Pick

Crevas unifies Veo 3, Sora 2, Nano Banana and more into one intuitive canvas — so filmmakers can script, prompt, and generate cinematic stories without switching tools or losing consistency.

Spark Alpha
fotominiatur.com favicon
Weekly Pick

AI Foto Edit - Text to Image & Image Edit

foto miniatur