Re: A new Tree-Sitter Grammar for D
On Monday, 17 October 2022 at 05:21:10 UTC, Garrett D'Amore wrote: I will probably see if this can be adopted into either the Tree Sitter or DLang community projects -- I'm not sure which is the better location. If you have thoughts please don't hesitate to let me know. I'm quite sure that the grammar itself could probably benefit from some further optimization, and I welcome advice or contributions! Please try to put it in tree-sitter official, since that will allow other editors(like the one I use) to automatically provide it as an option. Thanks for this wonderful project, really sad that the cybershadow one is basically stalled, but I sure hope that this replacement will fill in the gap wonderfully!!
A new Tree-Sitter Grammar for D
I'm happy to announce that I've created what I believe is a complete, or at least very nearly so, Tree-Sitter grammar for D. You can find it at https://github.com/gdamore/tree-sitter-d Tree-Sitter is a tool that enables dynamic AST generation for a variety of purposes, and is becoming quite popular with many editor projects. I've tested this grammar with as many different sources as I can find, including the test cases for the DMD compiler itself, as well as various other community sources and proprietary sources. It does not include support for preview syntaxes for bit fields or shortened function bodies, but I believe it should cover just about every other case. I've been using this with the Helix editor, along with the Serve-D language server, with some success. Included in my repository are queries for highlighting, injection (really just comments), and text objects (so you can navigate across major structures if your editor supports it.). I have not yet implemented indent queries. This work includes a test suite that has a lot of test cases, but of course is probably still far from complete. For folks that care, out of 1067 test cases in the DMD compiler, this parses successfully all but 5. The five that do not parse are ones that contain errors in uninstantiated templates, a problem with #line directives involving multi-line comments (you should never encounter this!) and preview syntax support already mentioned. This grammar is slightly more strict than the officially posted grammar, as some constructs which are flagged only at semantic analysis are caught at parse time in my grammar. (Notably comma expressions are not legal in constructs where they would be evaluated as a single value -- DMD generates a compilation error at semantic analysis time whereas my grammar simply rejects them as legal syntax. This was done to reduce the overall size of the generated parser as reduce the number of conflicts that would have resolution.) I believe this grammar may be the complete and accurate machine readable grammar outside of the DMD compiler itself. Certainly this has fixes to numerous defects found in both libdparse and in the official grammar, although both those projects were extremely useful as foundations to build upon. It is my hope that others will find this useful. I do welcome contributions of all forms -- whether bug reports, additional test cases, or grammar fixes or corrections. I am quite new to both Tree Sitter and to D, so it's entirely possible that I've missed something or misunderstood something! I will probably see if this can be adopted into either the Tree Sitter or DLang community projects -- I'm not sure which is the better location. If you have thoughts please don't hesitate to let me know. I'm quite sure that the grammar itself could probably benefit from some further optimization, and I welcome advice or contributions!
Emu6502: A simple MOS 6502 emulator written in D
I've recently been messing around with the MOS 6502 processor which was used in many retro systems of the 1980s, however, what's annoyed me is that there isn't really an easy way just to mess around with code and see what happens. The closest thing is the [Virtual 6502](https://www.masswerk.at/6502/) which is decent, but it's online which means you have to deal with uploading files and such, and it also doesn't really have enough configuration options for my taste. Considering I like D and that I couldn't find a DUB package that already emulated the 6502, I decided to make my own emulator, which is currently called Emu6502 (very original name, I know). It supports most features of the 6502, with the exception of a few small things (which are listed under the TODO section of the readme). Here's an example program: ```d module example; import std.stdio; import emu6502; void main() { ubyte[0x1] memory; ubyte[] code = [ 0xA2, 0x00, // lda #0 // loop: 0xBD, 0x0E, 0x80, // lda data,x 0x8D, 0x00, 0xE0, // sta $E000 0xC9, 0x00, // cmp #0 0xE8, // inx 0xD0, 0xF5, // bne loop 0x00, // brk // data: .asciiz 'Hello, World!\n' 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x2C, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x21, 0x0A, 0x00 ]; // put code into memory foreach(i, b; code) memory[0x8000+i] = b; // set reset vector memory[0xFFFC] = 0x00; memory[0xFFFD] = 0x80; // create emulator auto emu = new Emu6502( (ushort address) { return memory[address]; }, (ushort address, ubyte value) { if(address == 0xE000) write(cast(char)value); else memory[address] = value; }, (ubyte n) {} ); emu.reset(); emu.throwExceptionOnBreak = true; // run until brk triggered try { while(true) emu.step(); } catch(BreakException) {} } ``` Links: [Github Repo](https://github.com/TheZipCreator/emu6502) [DUB Package](https://code.dlang.org/packages/emu6502)
Re: Ali introduced D at Northeastern University
On Tuesday, 11 October 2022 at 18:01:05 UTC, Ali Çehreli wrote: On 10/8/22 16:11, Walter Bright wrote: Just posted it in the "New" section of HackerNews On the front page at the moment. Ali Thanks again Ali :) If there are other folks in the Dlang community who might want to give student-centered talks, please feel free to reach out. Northeastern has a few campuses across the US (Silicon Valley, Seattle, etc), Canada (Vancouver), and London -- so in person is an option as well. -Mike
Serverino 0.3.0 - now with windows support
Hello there. I've just released a new version of serverino, a simple and ready-to-go http server with zero external dependencies (pure D!). I changed a lot of things under the hood from the last version and tests are welcome. It works on linux, macos and windows. I use only linux, so I didn't test so much on other platforms. I started the project since we need a fast and easy way to setup a server for services, small websites or simply to do some tests on the browser and this is its main focus (but don't worry: it can handle several thousands of requests for seconds) To start a new website just write: ``` dub init test_serverino -t serverino cd test_serverino dub ``` And you're done. More info here: https://github.com/trikko/serverino Andrea
Beerconf October 2022
# BEERCONF! Beerconf this month is on October 29-30, one day before Halloween. Feel free to wear your D costume, might I suggest a beerconf T shirt? https://www.zazzle.com/store/dlang_swag/products?cg=196874696466206954 ## What is beerconf? Check out the [wiki article](https://wiki.dlang.org/Beerconf). ## Presentations? As usual, anyone who wants to reserve some time to talk about something, let me know. Cheers! -Steve