r/ProgrammingLanguages • • Jan 17 '26

Requesting criticism Vext - a programming language I built in C# (compiled)

Hey everyone!

Vext is a programming language I’m building for fun and to learn how languages and compilers work from the ground up.

I’d love feedback on the language design, architecture, and ideas for future features.

Features

Core Language

  • Variables - declaration, use, type checking, auto type inference
  • Types - int, float (stored as double), bool, string, auto
  • Expressions - nested arithmetic, boolean logic, comparisons, unary operators, function calls, mixed-type math

Operators

  • Arithmetic: + - * / % **
  • Comparison: == != < > <= >=
  • Logic: && || !
  • Unary: ++ -- -
  • Assignment / Compound: = += -= *= /=
  • String concatenation: + (works with numbers and booleans)

Control Flow

  • if / else if / else
  • while loops
  • for loops
  • Nested loops supported

Functions

  • Function declaration with typed parameters and return type
  • auto parameters supported
  • Nested function calls and expression evaluation
  • Return statements

Constant Folding & Compile-Time Optimization

  • Nested expressions are evaluated at compile time
  • Binary and unary operations folded
  • Boolean short-circuiting
  • Strings and numeric types are automatically folded

Standard Library

  • print() - console output
  • len() - string length
  • Math functions:

    • Math.pow(float num, float power)
    • Math.sqrt(float num)
    • Math.sin(), Math.cos(), Math.tan()
    • Math.log(), Math.exp()
    • Math.random(), Math.random(float min, float max)
    • Math.abs(float num)
    • Math.round(float num)
    • Math.floor(float num)
    • Math.ceil(float num)
    • Math.min(float num)
    • Math.max(float num)

Compiler Architecture

Vext has a full compilation pipeline:

  • Lexer - tokenizes source code
  • Parser - builds an abstract syntax tree (AST)
  • Semantic Pass - type checking, variable resolution, constant folding
  • Bytecode Generator - converts AST into Vext bytecode
  • VextVM - executes bytecode

AST Node Types

Expressions

  • ExpressionNode - base expression
  • BinaryExpressionNode - + - * / **
  • UnaryExpressionNode - ++ -- - !
  • LiteralNode - numbers, strings, booleans
  • VariableNode - identifiers
  • FunctionCallNode - function calls
  • ModuleAccessNode - module functions

Statements

  • StatementNode - base statement
  • ExpressionStatementNode - e.g. x + 1;
  • VariableDeclarationNode
  • IfStatementNode
  • WhileStatementNode
  • ForStatementNode
  • ReturnStatementNode
  • AssignmentStatementNode
  • IncrementStatementNode
  • FunctionDefinitionNode

Function Parameters

  • FunctionParameterNode - typed parameters with optional initializers

GitHub

https://github.com/Guy1414/Vext

I’d really appreciate feedback on:

  • Language design choices
  • Compiler architecture
  • Feature ideas or improvements

Thanks!

7 Upvotes

24 comments sorted by

View all comments

Show parent comment

1

u/csharpboy97 Jan 18 '26

its "just" cleaner code. I mean talking about making languages. I've made several languages and made frameworks (because I made to many). My last language is compiling directly to msil.

1

u/[deleted] Jan 18 '26

Oh cool!
This is my first language, and I am just learning how to make them. What do you think of the language up to this point?

1

u/csharpboy97 Jan 18 '26

It's just like any other c-like language. Some tests would be helpful.

1

u/[deleted] Jan 18 '26

What tests?
I regularly run the code the default code (and I add features to it as I add them to the language, for loops were my latest)

1

u/csharpboy97 Jan 18 '26

automated tests help to make sure your behavior is consistent. If you work on a feature you can break older code. By only testing the newest implemented feature you cannot make sure the old code doesn't work anymore.

1

u/[deleted] Jan 18 '26

But I don't overwrite the default code I'm testing the compiler on, I just add features to it

2

u/helloish Jan 18 '26

it’s very common in programming languages to accidentally introduce a regression, it’s worth writing some simple tests to verify that you don’t. bear in mind that even mainstream languages mess up quite often so anything you can do to prevent that is worth it

1

u/[deleted] Jan 18 '26

I mean, I get it, but like, I am still testing all of the previous features on every run.
Like, when I added for loops, I just *added* it to the test code, so when I run the compiler, it consumes all of the previous features, as well as the new ones, meaning everything is tested at all runs.

1

u/helloish Jan 18 '26

i don’t know much about c# but snapshot testing with something like verify could be useful for checking that the bytecode of existing programs doesn’t change/changes as expected

1

u/[deleted] Jan 18 '26

Cool, thanks! I'll check it out

1

u/csharpboy97 Jan 18 '26

I am using it to test my parser framework.