Code Monkey home page Code Monkey logo

eggscript's Introduction

hello

i like programming. i pinned some of the projects that i think best represent me and my programming ability. have fun!

eggscript's People

Contributors

bansheerubber avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

eggscript's Issues

Error checking

error checking can be accomplished by figuring out if a particular expression is supposed to be in a specific location or not. for instance, operators or literals cannot not have a parent that is a code block. an if statement or a function declaration cannot have a parent that is a variable assignment. doing those sorts of checks should reduce the amount of errors that we pass to .cs files.

additionally, some error messages are vague and unhelpful. if you do something like:

for(%i = 0; %i < 50; %i++) 
      %hey += %i;
}

then you may get an EOF error, which doesn't make too much sense. additionally, it'll give you an incorrect line number and character number for the source of the error too, further confusing things.

i was thinking of being lazy and having torquescript do all of the hard work, but the program really should be able to detect things on its own. error checking is so lacking right now that

%variable = someMethod();
else {
      echo("hey");
}

is treated as entirely correct.

Operator ban inconsistencies

when setting the operator ban before backtracking, its sometimes set incorrectly and we skip over characters that we should be parsing. for instance, if quotes are treated as an operator, then the parser will read strReplace(%string, ",", "") and output it as strReplace(%string, "," ""). this misses the comma outside of the string, because that comma is included in the operator ban. this example is an extremely special case, since " and , are operators. the operator search continues way past the string out of necessity. it stops when it encounters the space. the parser doesn't know any better and assumes that the string ",", could hold a potentially valid operator eventually, so we must keep going. this backtracking is very performant and otherwise entirely safe to use, so i'm not going to reengineer how it entirely works just for this case.

i think the error is happening because the operator ban factors in spaces, while the rest of the parser doesn't. we should probably subtract the amount of spaces we encounter in an operator search from the index the operator ban ends at.

Clean up tokenizer

The tokenizer function is very busy and sort of poorly designed. There are two main ways we detect tokens: through keywords and through operator give backs. It is likely that I could combine both of these methods of detection into one. Additionally, we could probably remove the big if-else chain going on that picks up the remaining scraps of the syntax. Hopefully, the tokenizer function shouldn't grow too out of control now that vector expressions are added -- I do not have any plans that require additional modification in the future.

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.