eupolicy.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
This Mastodon server is a friendly and respectful discussion space for people working in areas related to EU policy. When you request to create an account, please tell us something about you.

Server stats:

217
active users

#parser

0 posts0 participants0 posts today

(Towards):
A #sidescrolling #textAdventure #game as the host of a Pratt Grammar #Parser:
lispy-gopher-show.itch.io/lisp
#itch #itch_io #gameDev #lisp #commonLisp #repl

Sharpsign lengthy and wandering. Sharpsign happy 2025

Basically, I was having trouble imagining parsing a grammar at all. So I imagined input tokens as a sidescroller level I could cdr-code speedrun passes of. And you know, when lisp people imagine things it happens in real life too.

I just released pyparsing 3.2.1 with a very cool addition to the railroad diagrams that pyparsing generates for its parsers - non-terminal diagram elements now link to their definitions elsewhere in the diagram! This is pretty handy when the diagram is for a complex parser, as in this demo of a parser/evaluator for time references like "3 weeks from today" or "0800 two days from now" or "in exactly twenty-four hours". #pyparsing #python #parser #railroaddiagram

Currently dallying with a simple embedded, statically typed scripting language. The magic is an extensible lexer and parser, with the hosting application able to do something like

VM_addCommand(vm, KEYWORD(“open”), KEYWORD(“file”), TYPE(STRING), KEYWORD(“as”), REFERENCE, END);

to allow something like

open file “foo.txt” as myFile

It’s obviously been done before, but it’s fun to play with. I haven’t done enough #compiler or #parser work lately.

Over the past few days I've been working on extending & re-packaging the procedural text generation engine from one of the old examples into a new package and also just wrote/updated documentation for its various features:

- variable definitions, optionally with multiple value choices
- cyclic & recursive variable references/expansion
- variable assignments
- dynamic, indirect variable lookups (for context specific situations)
- optional preset & custom modifiers (i.e. pointfree/concatenative application of modifier sequences)
- controlled randomness during var expansion

The new package is called: thi.ng/proctext (6.5KB incl. all deps) The text format used relies on a simple parser grammar defined and processed via thi.ng/parse. The resulting document AST is then interpreted via thi.ng/defmulti

Please see readme for notes/examples, as well as the refactored example project below. The tool is very useful for complex source code generation, but also could be useful for bots, interactive fiction etc. The generator is stateful and variable state can be optionally retained/re-used over multiple invocations. Making all modifiers async is also providing a lot of flexibility (e.g. loading external data sources, generating secondary/expanded descriptions etc.)

Demo (incl. 5 examples and can be used as playground):
demo.thi.ng/umbrella/procedura

thi.ng/proctextExtensible procedural text generation engine with dynamic, mutable state, indirection, randomizable & recursive variable expansions

JSON is probably the most used standard file format for storing and transmitting data on the Internet in recent times. It has a simple syntax with only four scalar data types and two composite data types. So, writing a parser for #JSON is a great exercise for learning the basics of parsing.

That's exactly what I did: I wrote a JSON #parser from scratch in #Haskell. Read my #blog post to learn about basics of parsing, nuances of the JSON syntax, and parser combinators and property-based #testing in Haskell: abhinavsarkar.net/posts/json-p

Many people say that #Rust is very hard to #prototype with or to #refactor. This couldn't be further from the truth! It is the exact opposite!

Let me share with you one of the most profound experiences I had with #RustLang on a casual sunday - a thread 🧵

I'm currently rewriting my #transpiler from #nom to #chumsky and until now everything has turned out great so far, until I've hit the following road block:
Implementing parsers by using #parser functions that have indirect #recursion.

1/11

Replied in thread

"Zigamus : Zombies au Vigamus" par marcovallarino

Hasard du tirage, c'est encore un jeu à #parser aujourd'hui. C'est la traduction d'un jeu italien qui a déjà eu le droit à une traduction anglaise. Réalisée avec #Inform6, elle est disponible avec ou sans illustrations.

[Description dans le post suivant parce qu'on atteint la limite de caractères]

marcovallarino.itch.io/zigamus

#FictionInteractive
#ConFI24

Continued thread
Continued thread

#weld

Before leaving the elf64, I wanted to write some tests. Fortunately for me, parsers written with nom are really easy to test, they are just functions!

github.com/Hywan/weld/compare/

When tests are easy to write, it's a pleasure to test everything.

With this test session, I've been able to fix one panic when reading a string in a data segment with an out-of-range offset.