Giter Club home page Giter Club logo

trinic's Introduction

I program in the pursuit of knowledge. Mainly I make programming languages

Test

trinic's People

Contributors

jansheikkinen avatar

Stargazers

 avatar

Watchers

 avatar  avatar

trinic's Issues

AST leaks memory

I know not how or why, but generation of the AST leaks memory according to my linter lol

Examples are outdated

The examples directory is filled with outdated representations of the language; all but one of the files have the extension .uc instead of .tc.

Need better error handling

At the moment, a simple error like in the code rint(420). produces the following error messages:

[PARSER ERROR]: (1, 5) Expected end of statement at (
[PARSER ERROR]: (1, 5) Expected expression at token (
[PARSER ERROR]: (1, 9) Expected end of statement at INTEGER
[PARSER ERROR]: (1, 9) Expected end of statement at )
[PARSER ERROR]: (1, 9) Expected expression at token )

In the end, I'd love this error to look more like:

[ERROR] (1, 5) Undefined function 'rint':
  rint(420).
  ^^^^

My current priority is getting rid of the cascading effect caused by a single error. Five messages due to the result of a single error is unacceptable. There should be one message for every one error.
Ideally, I'd have the functions that can produce errors return some sort of Result type akin to Rust, and once a statement reaches its first error, just print that and move directly onto the next statement. It'd have to be a pretty bad error to involve more than one statement at a time, so this is generally a good way to prevent cascading errors. Obviously, if any errors are returned anywhere, execution should stop after parsing is complete. I believe that's how Crafting Interpreters did it, which I'm loosely following.

Furthermore, a lot of the current error handling was written haphazardly. In some points, I intentionally wrote the code in a way where I wouldn't have to handle any errors that arose. And a lot of the code that I did write could be extracted into a separate src/error/error.c file, and it'd be pretty nice to clean all that up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.