A

A C-style language interpreter implemented by the TypeScript types

Hacker News

A C-style language interpreter implemented by the TypeScript types

Hello everyone! I've implemented a toy language called Toc using TypeScript's type system, with the aim of learning TypeScript's type gymnastics and exploring the power of type programming.Toc uses a C-style syntax, close to JavaScript, and supports both dynamic and base types (numbers, booleans, strings, and null). It allows variables, expressions, block statements, if-else conditional statements and for loops, functions as first-class citizens that can be passed in and out, and support for closures. Despite the implementation of the basic functionality, there are some unfortunate aspects, in particular functions do not support recursion (I don't know how to implement it). Also, functions don't support return statements, loops don't support break, etc. (these should be possible, I'm just a bit tired ). Error handling is also sketchy, as there is currently no line number information, making it difficult to locate errors when the program is long. There is also a lack of composite data types (such as objects or arrays). I would like to share this project with you and welcome any suggestions or contributions to improve it, especially to solve the problem of functions not supporting recursion! If you're interested in implementing these features, feel free to visit my GitHub repository at [Toc]( https://github.com/huanguolin/toc ) and submit a PR. I welcome discussion and feedback!

Share card

Actual performance

2points
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Strong signals: supports · Missing: reddit linkedin, podcasting, created
77%77% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Product HuntOn track for Day 1 leaderboard · Strong signals: using · Missing: mac, agents, macos
61%61% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
Hacker NewsMay not resonate with HN audience · Strong signals: io · Missing: https docs, excited, just released
47%47% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
41%41% predicted probability of success on AppSumo, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Missing: mobile apps, ios, personal
36%36% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Strong signals: arr · Missing: mrr, revenue, profit
14%14% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Nu
Nullable Types in TypeScript46%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Nullable Types in TypeScript

Hacker News1
Br
Brainfuck interpreter using TypeScript types45%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Brainfuck interpreter using TypeScript types

Hacker News2
Ty
TySON – TypeScript as a Configuration Language51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

TySON – TypeScript as a Configuration Language

Hacker News4
Fu
Functional data types for TypeScript development62%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Functional data types for TypeScript development

Hacker News2
Wo
Wordle Implemented in TypeScript Types51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Wordle Implemented in TypeScript Types

Hacker News2
Ex
Extra Types for TypeScript51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Extra Types for TypeScript

Hacker News1
Ge
Generate TypeScript Types from JSON Samples56%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Generate TypeScript Types from JSON Samples

Hacker News5
At
AttaLambda: a language where types and data are made of untyped lambdas50%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

AttaLambda: a language where types and data are made of untyped lambdas

Hacker News2
Ty
TypeScript types that conform to JSON schemas without code generation55%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

TypeScript types that conform to JSON schemas without code generation

Hacker News17
Se
Semantic Primitives- TypeScript types that understand natural language56%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Semantic Primitives- TypeScript types that understand natural language

Hacker News1