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.

Ask HN: Best approach to designing a parser / creating your programming language

3 pointsby archibaldJalmost 2 years ago
I&#x27;ve been writing a parser in Haskell Parsec to parse a subset of Haskell;<p>I didnt stick to anything like BNF and it turns out to be much more daunting task than expected.<p>When designing a parser for a (subset of) known language (or creating your own programming language), are things like BNF fundemental to a good design? What toolkits or frameworks can be employed in the planning process?<p>Any tips or approaches (or readings) on the best way to strike a balance between theoretical formalization v.s. implementing something that actually works and have good performance and easy to debug?

1 comment

richardjam73almost 2 years ago
I haven&#x27;t used parsec but I have used fparsec and I found that usage of the &quot;operator precedence parser&quot; was very useful in parsing expressions. It also sped up parsing a lot.<p>As for BNF, it is like a standard that your parser should follow. A map for when parsing gets complex. You may not need it for a simple parser.