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.

Implementing a programming language in D: Lexical Analysis

85 pointsby felixangell1024over 9 years ago

4 comments

landr0idover 9 years ago
Wow, perfect timing! I&#x27;m currently writing my first lexer&#x2F;parser in D as well (<a href="http:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;hsc" rel="nofollow">http:&#x2F;&#x2F;github.com&#x2F;landaire&#x2F;hsc</a>) for a Scheme-like language used in Halo 3. I found Rob Pike&#x27;s talk on lexical scanning to be pretty useful (<a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=HxaD_trXwRE" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=HxaD_trXwRE</a>) and I&#x27;ve modeled mine pretty heavily after the text&#x2F;template lexer: <a href="https:&#x2F;&#x2F;golang.org&#x2F;src&#x2F;text&#x2F;template&#x2F;parse&#x2F;lex.go" rel="nofollow">https:&#x2F;&#x2F;golang.org&#x2F;src&#x2F;text&#x2F;template&#x2F;parse&#x2F;lex.go</a>.
dimglover 9 years ago
I&#x27;ve never seen the D language before and I have to admit, it looks very elegant and has piqued my interest. Thanks for your post.<p>I&#x27;m wondering why you used D rather than Rust? Was it just that you were curious about the D language or is there something about Rust that you don&#x27;t like?
评论 #10803712 未加载
评论 #10803373 未加载
评论 #10803127 未加载
评论 #10803118 未加载
评论 #10803660 未加载
ksherlockover 9 years ago
Another option is to use a lexer&#x2F;state machine generator. Ragel support D and Rust (as of the not-quite-released v7) as target languages.
nunullover 9 years ago
Nice read! I&#x27;d really like to know when we can expect the next post to be published.
评论 #10823211 未加载