Pull to refresh
209.71

Abnormal programming *

Perversions with code

Show first
Rating limit
Level of difficulty

Tree-sitter and Preprocessing: A Syntax Showdown

Level of difficultyMedium
Reading time5 min
Views832

According to the description,


Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited.

But how does Tree-sitter handle languages that require a preprocessing stage?

Read more →

Building blocks in programming languages

Level of difficultyMedium
Reading time5 min
Views718

Practically all programming languages are built either on the principle of similarity (to make like this one, only with its own blackjack) or to realize some new concept (modularity, purity of functional calculations, etc.). Or both at the same time.


But in any case, the creator of a new programming language doesn't take his ideas randomly out of thin air. They are still based on his previous experience, obsession with the new concept and other initial settings and constraints.


Is there a minimal set of lexemes, operators, or syntactic constructs that can be used to construct an arbitrary grammar for a modern general-purpose programming language?

Read more →

Possible solution to the problem of references in programming languages

Level of difficultyMedium
Reading time4 min
Views628


Every programmer is familiar with the concept of "reference." This term usually refers to a small object whose main task is to provide access to another object physically located elsewhere. Because of this, references are convenient to use, they are easily copied, and they make it very easy to access the object to which the reference points, allowing access to the same data from different parts of the program.


Unfortunately, manual memory management, or more precisely, manual memory control, is the most common cause of various errors and vulnerabilities in software. All attempts at automatic memory management through various managers are hampered by the need to control the creation and deletion of objects, as well as periodically run garbage collection, which negatively affects application performance.


However, references in one form or another are supported in all programming languages, although the term often implies not completely equivalent terms. For example, the word "reference" can be understood as a reference as an address in memory (as in C++) and a reference as a pointer to an object (as in Python or Java).


Although there are programming languages that try to solve these problems through the concept of "ownership" (Rust, Argentum, or NewLang). The possible solution to these and other existing problems with references will be discussed further.

Read more →

gookit/goutil — released v0.6.10, an extension library of common Go features

Level of difficultyMedium
Reading time5 min
Views752

gookit/goutil An extended library of Go's common functionality. Contains: number, string, slice/array, Map, struct, reflection, text, file, error, time and date, test, CLI, command run, system information, formatting, common information acquisition, etc.

Read more

DSL (domain-specific language) implementation with macros

Level of difficultyMedium
Reading time8 min
Views2.5K

image
This is a translation of my own article


The release of NewLang language with a brand new "feature" is coming, a remodeled version of the preprocessor that allows you to extend the language syntax to create different DSL dialects using macros.


What is it about?


DSL (Subject Oriented Language) is a programming language specialized for a specific application area. It is believed that the use of DSL significantly increases the level of abstractness of the code, and this allows to develop more quickly and efficiently and greatly simplifies the solution of many problems.

Conditionally, we can distinguish two approaches to DSL implementation:


  • Development of independent syntax translators using lexer and parser generators to define the grammar of the target language through BNF (Backus–Naur form) and regular expressions (Lex, Yacc, ANTLR, etc.) and then compiling the resulting grammar into machine code.
  • Development or integration of the DSL dialect into a general-purpose language (metalanguage), including the use of various libraries or special parsers / preprocessors.

We will talk about the second option, namely the implementation of DSL on the basis of general-purpose languages (metalanguages) and the new implementation of macros in NewLang as the basis for DSL development.

Read more →

Turning a typewriter into a Linux terminal

Reading time3 min
Views9.7K

Hi everyone, a few months ago I got a Brother AX-25, and since then, I've been working on turning it into a computer. It uses an Arduino to scan the custom mechanical keyboard and control the typewriter, and a Raspberry Pi is connected to the Arduino over serial so I can log into it in headless mode.

See how it works

Music on the Commodore PET and the Faulty Robots

Reading time26 min
Views2.9K

After completion of the System Beeps, I wasn’t planning to make another stand alone album release with the pseudo polyphonic music, as I felt the topic had been explored enough. This, however, wouldn’t mean I couldn’t apply the experience and skills gained to make more utilitarian stuff, like an actual retro game OST or an old school demoscene project. Such an opportunity arose in Autumn 2020, as David Murray of The 8-bit Guy Youtube channel fame announced his new game to be in development, the Attack of The PETSCII Robots for Commodore PET and some other Commodore 8-bitters. As I previously worked with David on his previous big release, Planet X3 game for MS-DOS, and this was a perfect opportunity to satisfy my interest towards the pre-graphics era PCs as well as apply my vast experience both in the minimalistic computer music and 6502 assembly programming, I offered my services that had been accepted. Besides the sound code I also had hopes to participate as a music composer this time.

Unfortunately, this time the project didn’t went well on my side, and lots of issues of all kinds eventually turned it into a small scale development hell (you can learn more from a series of posts at my Patreon blog)  The end result was that my code and sound effects were only used in the VIC-20 port, and music for other versions has been created by other people. However, I was left with the full working code of the sound system for PET, and a number of music sketches. It would be a pity to file it into the archive, PET projects aren’t a frequent thing these days, so another chance to use the stuff wouldn’t come any time soon. So I got the idea to develop my music sketches into full songs, and release it as an alternative OST, and having David’s approval it has been done and released in the Winter 2021 as Faulty Robots, a small music album for PET that is available as a digital audio release and a runnable program for the actual PET computer.

Read more

Full motion video with digital audio on the classic 8-bit game console

Reading time13 min
Views1.5K

Back in 2016 an United States based music composer and performer Sergio Elisondo released an one-man band music album A Winner Is You (know your meme), with multi-instrumental cover versions of tunes from numerous memorable classic NES games. A special feature of this release has been its version released in the NES cartridge format that would run on a classic unmodified console and play digitized audio of the full album, instead of the typical chiptune sound you would expect to come from this humble console. I was involved with the software development part of this project.

This year Sergio makes a return with a brand new music release. This time it is all original music album You Are Error, heavily influenced with the video game music aesthetics. It also comes with a special extra. This time we have raised the stakes, and a new NES cartridge release includes not only the digitized audio, but full motion videos for each song, done in the silhouette cutout style similar to the famous Bad Apple video. Yet again, this project is crowdfunded via Kickstarter. It already got the asked amount in a mere 7 hours, but there is still a little time to jump on the bandwagon and get yourself a copy. In the meantime I would like to share an insight on the technical side of both projects.

Read more

Go Rant: Highly Opionated View About Reaches and Gotchas of Goland

Reading time4 min
Views1.5K

In this series, I would like to discuss some reaches of Go programming language. There is no shortage of Go-Language-Of-Cloud style articles in which you can explore the great benefits that Go indeed provides. However, there are lees to every wine, and Go does not go without blemish. In this highly opinionated series, we cover some controversies and, dare I say, pitfalls of the original Go design.


We start tough and begin with the essence of Go — it's inbuild data types. In this article, we put slice to the test. Let's move a step further from the Go Tour and use slice more extensively. For example, there is no separate data type as stack in Go, because slice type is intended to cover all its usage scenarios.


Let's briefly recap the usage of the stack. We can create a stack in two seconds using a couple of paper stickers. You write "buy milk" on the first sticker and put at the desk, and then "make the dishes" on the second and pile it on the first sticker. Now, you have a stack: the dishes sticker came last but will be served first, as it is on the top of the stack. Thus, there is an alternative name for stack — LIFO, Last-In-First-Out. To compare, there is the "opposite" data structure queue or FILO — first in, first out. In programming, stacks are everywhere, either in the explicit form or in the implicit as stack trace of the execution of a recursive function.


Ok, let's put slice into use and implement stack.

Read more →

Go Quiz

Reading time3 min
Views3.3K

In this series, we will be discussing interesting aspects and corner cases of Golang. Some questions will be obvious, and some will require a closer look even from an experienced Go developer. These question will help to deeper the understanding of the programming language, and its underlying philosophy. Without much ado, let's start with the first part.


Value assignment


What value y will have at the end of the execution?


func main() {
    var y int
    for y, z := 1, 1; y < 10; y++ {
        _ = y
        _ = z
    }
    fmt.Println(y)
}

According to the specification,

Read more →

Russian AI Cup 2020 — a new strategy game for developers

Reading time5 min
Views2.5K


This year, many processes transformed, with traditions and habits being modified. The rhythm of life has changed, and there's more uncertainty and strain. But IT person's soul wants diversity, and many developers have asked us if annual Russian AI Cup will be held this year. Is there going to be an announcement? What is the main theme of the upcoming championship? Should I take a vacation?

Though some changes are expected, it will be held in keeping with the best traditions. In the run-up, we will announce one of today's largest online AI programming championships — Russian AI Cup. We invite you to make history!

How to write Palindrome Polyglot Quines

Reading time10 min
Views2.6K
PalidromePolyglotQuine

I offer a solution to one beautiful task — writing code that outputs its text is valid for interpreters and compilers of different languages and is correctly executed when reversing its sources.


Not so long ago I learned about code that can be both interpreted in PHP and compiled to Java: PhpJava.java. As it turned out, this idea is not new: code which is valid for several compilers or interpreters is called a polyglot. It is possible to write such code because of the peculiarities of processing strings and comments in different interpreters or compilers.

Read more →

Dark code-style academy: line breaks, spacing, and indentation

Reading time4 min
Views2.5K

Hey guys! Let me walk you through the next part of our dark-style code academy. In this post, we will discover some other ways how to slow down the reading speed of your code. The next approaches will help you to decrease maintenance and increase a chance to get a bug in your code. Ready? Let's get started.

Read more

Dark code-style academy: spoil if statement

Reading time3 min
Views2.1K

image


Do you want to raise your salary? Do you want always to be in demand? Do you want to have your job as long as you want? It is absolutely real! You just need to change the way you write your code. Basically, you need to increase your job security. You have to write code which will be almost impossible to maintain for everyone except you. And in these series of articles, I will tell you how to achieve it. Welcome under the cut.

Read more →

Why I keep track of spendings in a personal app made with Git+JS

Reading time4 min
Views1.4K

Hi, folks, let me share my experience of creating an application to keep track of my spendings. Specifically, let me do it by answering the following questions:


  1. Why keep track of spendings in an application?
  2. Why did I create the application as a personal project?
  3. Why does the project use Git+JS?

1. Why keep track of spendings in an application?


I, like many people out there, wanted to become rich and successful. To become rich, one is often advised to run a personal budget, that's what I started to do several years ago. I'd like to point out that running my personal budget hasn't made me rich and successful, and I increased income simply by moving to Moscow.

The Silverfish Programming Language

Reading time9 min
Views2.6K

They say, each professional developer must have done at least three pet projects: a sophisticated logging utility, a smart json parser, and an amazing programming language. Once we have both logger and parser accomplished, we finally decided to reveal our desperate success in creation one of the most innovative programming languages named Silverfish.


Карасик → На самом деле плотвичка

Read more →

Teaching folks to program 2019, a.k.a. in the search of an ideal program: Sequence

Reading time8 min
Views743

MUROM


Hi, my name is Michael Kapelko. I'm a professional software developer. I'm fond of developing games and teaching folks to program.


Preface


Autumn 2019 was the third time I participated as one of the teachers in the course to teach 10-15-year-old folks to program. The course took place from mid. September to mid. December. Each Saturday, we were studying from 10 AM to 12 PM. More details about the structure of each class and the game itself can be found in the 2018 article.


I have the following goals for conducting such courses:


  • create a convenient tool to allow the creation of simple games, the tool interested folks of 10 years old or older can master;
  • create a program to teach programming, the program interested folks of 10 years old or older can use themselves to create simple games.
Read more →

Making a demo for NES — HEOHdemo

Reading time26 min
Views5.6K
There is a lengthy history of computer arts festivals, also known as demo parties, held in Russia over the last quarter century. For decades, once in a while people from all over the country gather together to compete in their ingenuity at getting what was once deemed impossible out of the old or new computer hardware and mere bytes of code. A few leading annual events has been established in the early years. One of them, creatively named CAFe (an acronym for Computer Art FEstival), was held in Kazan from 1999 to 2003. It went under the radar since, making the way for the everlasting Chaos Constructions (1999 — now) and DiHalt (2005 — now). After so long hiatus, the last year CAFe made a loud comeback, returning in full glory — at least by the number of prods released, if not in the scale of the event itself. Presentation of the compo entries went far into the night, with the last demos being shown at 6 AM to the popping eyes of the few hardy ones. There was my demo, too, and this is the story of its making.

Read more →

Making a demo for an old phone — AONDEMO

Reading time13 min
Views4K
I wanted to make a demo ever since I saw the classic Polish mega demo Lyra II for first time in 1997. I also wanted to do something for the largest Russian demo party Chaos Constructions for a long while, but have never gotten around that, being occupied with other duties. Finally, in 2018 the time has come, and I fulfilled both desires at once, Van Damm's double impact style — made a demo called AONDEMO that entered ZX Spectrum 640K Demo compo at Chaos Constructions.


I bet the red thing you've just seen does not look much a Spectrum to you. Here's the story.

Read more →

СodeSide. The new game for Russian AI Cup

Reading time3 min
Views2.5K


The AI Cup community and Mail.ru Group in collaboration with Codeforces.com invite you to the real battle! Get ready for the sleepless nights and calloused hands — take part in Russian AI Cup, which is one of the most challenging and vivid artificial intelligence programming competitions in the world. Believe us, managers of this madness did their best to create the game you'd want to play.


To become part of the competition, you need Internet access, computer, creativity, and enthusiasm for being a part of this extraordinary Cup. By the way, you might need some coffee. Welcome!

Read more →
1

Authors' contribution