rwillians
I’ve recently used NimbleParsec for parsing a programming language for a game/challenge, just for fun. It might not have been the best solution, but it was pretty good at getting the job done!
That got me wondering if anyone else has used NimbleParsec for parsing a programming language. And if so, how did you handle pretty-printing parsing errors? (I didn’t handle at all haha)
I’d love to see some examples to learn from them – and perhaps even add some examples to the lib’s documentation.
Also, if you know a more adequate lexer/parser for parsing programming langs in Elixir, please do let me know. I’d love some recommendations.
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Quite interesting article Google brought me. Didn’t find any mentions about it here.
What do you think in general? Would you use togethe...
New
Since we have deprecated our Erlang sections (as we have dedicated Erlang Forums now) let’s add this thread for those who’d like to post ...
New
:warning: Security advisory: Decimal DoS vulnerability
A vulnerability has been published for decimal where very large exponents can cau...
New
What IDE or editor are you using for Elixir development?
Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New
Other Trending Topics
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
D4no0
Now try and use lex/yacc from OTP, and you can write your own programming language that runs on OTP
kreiling.io
I haven’t used it for parsing an existing language but I’ve used it to parse DSLs. For example, I wrote a schema-less JSON document API on top of Elasticsearch and wrote a query language using NimbleParsec.
Can you provide any more detail about what you mean by pretty-printing exactly? I’ll provide some personal experience here though: I’ve found piping the result of
NimbleParsec.wrap_and_tag/3to theNimbleParsec.label/3function is really useful for improving error messages. In combination with the line+column integers in the error tuple returned bydefparsec-defined functions, I’ve managed to produce concise, easy-to-debug error messagesrwillians
Hey @kreiling.io
I’m unable to upload images, but here’s the link to screen shot of a “pretty-printed” error message Screenshot-2023-09-14-at-18-07-34 hosted at ImgBB — ImgBB
I think “prettry-print” wasn’t my best choice of wording there, I meant more like being able to provide fine grained error messages as one would expect from a compiler’s parser. using
label/3didn’t seem much helpful there (probably mb for misusing it).In case it interests you, here’s the repo I’m working on: GitHub - rwillians/rinha-de-compilers--elixir-transcompiler: Source-to-Source Transcompiler from `.rinha` to Elixir. Runs on ERTS (Erlang Runtime System). · GitHub
It’s a “source-to-source transcompiler” (fancy wording – I’m parsing from another lang, transpiling the ast to elixir then compiling). It’s just for fun, for a challenge.
rwillians
Nice! I wasn’t aware of those, I’ll look into it.
Thanks!
dimitarvp
To slightly correct @D4no0 it’s
leexandyecc.