TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Writing a compiler in Python using Lex, Yacc and LLVM

67 pointsby Alcidesover 15 years ago

3 comments

sketerpotover 15 years ago
Inspired by this, I've started writing a compiler for a subset of Matlab. I'm sick of Matlab being an interpreted language year after year, and while I don't hope to <i>change</i> that, I can at least do a proof-of-concept to lend weight to my derision.<p>I've got the lexer and parser done, thanks to Parsec, and some basic C code generation as a sanity check. Now for the runtime LLVM code generation, to make it feel like an interpreter! Thanks, HN!
评论 #832742 未加载
评论 #832750 未加载
jweckerover 15 years ago
He mentioned that llvm-py documentation was lacking... I was going through it, seems pretty darn good to me (relatively). <a href="http://mdevan.nfshost.com/llvm-py/userguide.html" rel="nofollow">http://mdevan.nfshost.com/llvm-py/userguide.html</a>
ilkhd2over 15 years ago
Impractical: 1) The compiler is gonna be very slow; 2) If you make compiler for low-level language, such as C you need precise correspondence between data types used in cpu, datatypes used in compiler's implementation language and datatypes in the target language.
评论 #832470 未加载
评论 #832499 未加载
评论 #832445 未加载