Nudl
- 5 Devlogs
- 14 Total hours
This is Nudl (Nearly User Defined Language). It's a programming language with no set syntax that compiles into a Rust project and then into native binaries.
This is Nudl (Nearly User Defined Language). It's a programming language with no set syntax that compiles into a Rust project and then into native binaries.
The parser and lexer now support math operations and comparisons! If statements can be nested as well, and plenty of cursed customization options also work with a simple edit of a JSON file. I’ve mostly been working on reworking the translator and parser to allow for nesting and operations, but now it (mostly) works! In the image below, the translated code is visible on the left, the source code is on the right, and on the bottom is the terminal output of running the project.
I started writing the translator and I got the first couple of lines to translate. Right now, only variable definitions, assignments and the print function translate over. In the image below, you can see the generated Rust code on the left and the source code on the right.
Now after the raw source code is tokenized, I feed the raw tokens to the parser, which matches different patterns of tokens to various types of nodes like defining a variable and calling a function! I’ve started working on building AST trees from these nodes. The image below shows the output of the parser, correctly identifying when I call a function or define a variable
First bit of parsing works! Right now, I’m working on the lexer, which turns your source code into tokens. The image below is what I got working so far: for now it prints the type of token it detects and then moves on to the next one. It correctly identifies the var keyword and String literals and assignment operators.
It is my own programming language with no set syntax. The way it works is you define your own syntax in the flavor.json file, and nudl will parse and translate your code into a Rust project. You can then build your nudl program to a native binary that runs blazingly fast. For support for Rust libraries, maps are used to translate Rust libraries into whatever syntax or names you want. So far, I’ve started learning Rust and coding the basic implementation of the nudl CLI interface in Rust. Running nudl create your-project will create a project folder set up like the one in the image below.