请问HN:TS编译器

3 分•作者: apple_george•大约 2 个月前•原帖
大家好,我是一名经验丰富的JavaScript和TypeScript开发者。 我喜欢JavaScript,胜过其他任何语言,主要是因为它让我能够轻松表达自己。出于某种原因,我觉得在JavaScript或TypeScript中表达自己比在其他语言中更容易。 不过,我想我们都很清楚JavaScript的一些不足之处,以及Go语言的出色之处。 我认为我们都非常喜欢Go语言的一个特性就是goroutine。 我认真考虑过制作一个版本的TypeScript,使其能够实现类似goroutine的功能。 我认真思考过如何实现这一点,包括修改V8,构建我自己的自定义编译器等。 经过深思熟虑,我发现我认为处理这个问题的最佳方法是,从Go编译器入手,修改它的解析器,使其能够解析TypeScript。 我设想的工作流程是,首先我们创建一个完美的TypeScript到Go的转译器。 一旦我们让转译器完美运行,接下来就是实际修改Go中的解析器,使其能够内部解析TypeScript,并将其转换为Go编译器使用的结构化表示。 我相信这将是实现真正的TypeScript编译器最有效、最重要的是最简单的途径。 我希望能得到一些帮助来构建这个项目,因为不幸的是,我现在没有电脑或任何资金。 如果有人愿意借给我一台笔记本电脑和Codex或类似的订阅服务,我将非常乐意开始这个项目。 我在这里看到有人制作了一个使用OXC和LLVM的TypeScript编译器,我觉得这真的很酷。然而,我认为为了让TypeScript成为人们真正喜欢使用的语言,最终必须具备类似goroutine的功能。 此外,趁此机会,我认为我们还应该添加一些功能,比如正确处理切片语法,以便我们能够在TypeScript中进行人工智能开发。 老实说,现在AI可以编写所有代码,我不太确定编程语言是否真的那么重要,但我仍然认为这是一个有趣的项目。 我认为这个项目的主要缺点在于,现在几乎每个人都在用Rust编写所有代码,并将其编译为WebAssembly等,所以我不确定在AI可以编写所有代码的情况下,这是否仍然是一个值得做的项目,但我很想听听大家的想法。
查看原文
Hey everyone, I am an experienced JavaScript and TypeScript developer.<p>What I love about JavaScript more than any other language is that it is so easy for me to express myself. It’s easier for me to express myself in JavaScript or TypeScript than any other language for some reason.<p>I think we all, however, are really aware of some of the shortcomings of JavaScript and of how amazing Go is.<p>The feature about go that I think we all really love is goroutines.<p>I have thought really hard about making a version of TypeScript that includes the ability to do something like a goroutine.<p>I have seriously debated how to make this work, including modifying V8 building my own custom compiler, etc.<p>After much thought, I have come across what I believe is the best way to handle this. I think ultimately the best way to do this would be to start with the go compiler and to modify it’s parser so that it can actually parse TypeScript.<p>The way I envision this working is first what we do is we create a perfect TypeScript to go transpiler.<p>Once we have the transpiler working perfectly then we take the next step which would be to actually modify the parser in Go to internally parse it and convert it to the structured representation that the go compiler uses.<p>I believe that this is going to be the most efficient and most importantly, the easiest route to making a true type script compiler.<p>I would like to get some help on building this because unfortunately I no longer have a computer or any money right now.<p>If anyone would like to loan a laptop and a Codex or some type of a subscription like that, I would love to get started.<p>I saw on here that somebody made a type script compiler that uses OXC and LLVM which I think is really cool. However, I think that in order for type script to be something that people really like using it’s gonna have to have something like go routines in the end.<p>Also, while we are at it, I think we should go ahead and add something like the ability to handle slice syntax correctly so that we can do artificial intelligence in type script.<p>Honestly, now that AI codes everything I’m not really sure that the programming language matters that much but I still think it would be a fun project to work on.<p>I think the major downside to this is that essentially everybody now is writing everything in rust and compiling it down to Web assembly and stuff like that so I’m not sure if this is actually a worthwhile project to do at all now that AI codes everything but I would love to know everyone’s thoughts.