Building for new ATtiny 2-series chips on Debian
LeoNerd's programming thoughts
by
8M ago
I have previously written about how to build code for the ATtiny 1-series chips on Debian, outlining what files are missing from Debian in order to allow this. It seems, three years on, the same stuff is still missing - and moreso now that the new 2-series chips are available. Here now, is some more instructions on top of that to get code working for these newer chips as well. As before, start off by downloading the "Atmel ATtiny Series Device Support" file from http://packs.download.atmel.com/. This is a free and open download, licensed under Apache v2. This file carries the extension atpack ..read more
Visit website
Perl UV binding hits version 2.000
LeoNerd's programming thoughts
by
2y ago
Over the past few months I've been working on finishing off the libuv Perl binding module, UV. Yesterday I finally got it finished enough to feel like calling it version 2.000. Now's a good time to take a look at it. libuv itself is a cross-platform event handling library, which focuses on providing nicely portable abstractions for things like TCP sockets, timers, and sub-process management between UNIX, Windows and other platforms. Traditionally things like event-based socket handling have always been difficult to write in a portable way between Windows and other places due to the very differ ..read more
Visit website
Writing a Perl Core Feature - part 11: Core modules
LeoNerd's programming thoughts
by
3y ago
Index | < Prev Our new feature is now implemented, tested, and documented. There's just one last thing we need to do - update the bundled modules that come with core. Specifically, because we've added some new syntax, we need to update B::Deparse to be able to deparse it. When the isa operator was added, the deparse module needed to be informed about the new OP_ISA opcode, in this small addition: (github.com/Perl/perl5). --- a/lib/B/Deparse.pm+++ b/lib/B/Deparse.pm@@ -52,7 +52,7 @@ use B qw(class main_root main_start main_cv svref_2object opnumber perlstring MDEREF_SHIFT );-$VE ..read more
Visit website
Writing a Perl Core Feature - part 10: Documentation
LeoNerd's programming thoughts
by
3y ago
Index | < Prev | Next > Now that have our new feature nicely implemented and tested, we're nearly finished. We just have a few more loose ends to tidy up. The first of these is to take a look at some documentation. We've already done one small documentation addition to perldiag.pod when we added the new warning message, but the bulk of documentation to explain a new feature would likely be found in one of the main documents - perlsyn.pod, perlop.pod, perlfunc.pod or similar. Exactly which of these is best would depend on the nature of the specific feature. The isa feature, being a new in ..read more
Visit website
Writing a Perl Core Feature - part 9: Tests
LeoNerd's programming thoughts
by
3y ago
Index | < Prev | Next > By the end of part 8 we finally managed to see an actual implementation of our new feature. We tested a couple of things on the commandline directly to see that it seems to be doing the right thing. For a real core feature though it would be better to have it tested in a more automated, repeatable fashion. This is what the core unit tests are for. The core perl source distribution contains a t/ directory with unit test files, very similar to the structure used by regular CPAN modules. The process for running these is a little different; as we already saw back in p ..read more
Visit website
Writing a Perl Core Feature - part 8: Interpreter internals
LeoNerd's programming thoughts
by
3y ago
Index | < Prev | Next > At this point we are most of the way to adding a new feature to the Perl interpreter. In part 4 we created an opcode function to represent the new behaviour, part 5 and part 6 added compiler support to recognise the syntax used to represent it, and in part 7 we made a helper function to provide the required behaviour. It's now time to tie them all together. When we looked at opcodes and optrees back in part 4, I mentioned that each node of the optree performs a little part of the execution of a function, with child nodes usually obtaining some piece of data somewh ..read more
Visit website
Writing a Perl Core Feature - part 7: Support functions
LeoNerd's programming thoughts
by
3y ago
Index | < Prev | Next > So far in this series we've seen several modifications and small additions, to add the required bits and pieces for our new feature to various parts of the perl interpreter. Often when adding anything but the very smallest and simplest of features or changes, it becomes necessary not just to modify existing things, but to add some new support functions as well. For example, adding the isa feature required adding a new function to actually implement the bulk of the operation, which is then called from the pp_isa opcode function. This helper function was added into ..read more
Visit website
Writing a Perl Core Feature - part 6: Parser
LeoNerd's programming thoughts
by
3y ago
Index | < Prev | Next > In the previous part I introduced the concepts of the lexer and the parser, and the way they combine together to form part of the compiler which actually translates the incoming program source code into the in-memory optree where it can be executed. We took a look at some parser changes, and the way that the isa operator was able to work with that alone without needing a corresponding change in the parser, but also noted that most non-trivial syntax additions will require concurrent changes to both the parser and the lexer to cope with it. In particular, although ..read more
Visit website
Writing a Perl Core Feature - part 5: Lexer
LeoNerd's programming thoughts
by
3y ago
Index | < Prev | Next > Now we have a controllable feature flag that conditionally recognises our new keywords, and we have a new opcode that we can use to implement some behaviour for it, we can begin to tie them together. The previous post mentioned that the Perl interpreter converts source code of a program into an optree, stored in memory. This is done by a collection of code loosely described as the compiler. Exactly what the compiler will do with these new keywords depends on its two main parts - the lexer, and the parser. If you're unfamiliar with these general concepts of compile ..read more
Visit website
Writing a Perl Core Feature - part 4: Opcodes
LeoNerd's programming thoughts
by
3y ago
Index | < Prev | Next > Optrees and Ops Before we get into this next part, I want to first explain some details about how the Perl interpreter works. In summary, the source code of a Perl program is translated into a more compiled form when the interpreter starts up and reads the files. This form is stored in memory and is used to implement the behaviour of the functions that make up the program. It is called an Optree. Or rather more accurately, every individual function in the program is represented by an Optree. This is a tree-shaped data structure, whose individual nodes each represe ..read more
Visit website

Follow LeoNerd's programming thoughts on FeedSpot

Continue with Google
Continue with Apple
OR