Code Monkey home page Code Monkey logo

y2k's Introduction

y2k's People

Contributors

benbusby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

y2k's Issues

Negative numeric values

Currently there isn't a way to define a negative value.

The easiest way to approach this would be to create new variable types that are "negative" versions of existing or future data types (int -> -int, float -> -float), but that would mean consuming slots of variable types, which is maxed out at 9 (unless we want to enforce 2-digit parsing for complex data types in the future). It would also mean some potentially weird handling of those variables. For example, we wouldn't want to write separate cases for how to handle += of a negative vs positive integer.

Another approach would be to add another public element to Y2KVar that would toggle negative/positive for that variable. I'm reluctant to do that though, since that value wouldn't really make sense for string types, so it would be a wasted cycle.

I'm open to suggestion on how to implement this.

Syntax highlighting

Depends on how #1 is implemented, and is maybe a little goofy, but it might be nice to be able to quickly visually parse what a raw.y2k file contains, where lines starting with different commands are highlighted different colors, and comments are highlighted in an obvious color.

This is obviously heavily editor dependent, but would be neat if there was at least a Vim syntax theme and maybe support in Pygments.

"Raw" edit mode

Basically the syntax seen in the "Fizz Buzz" example, or the example given in the FAQ, but parseable by the interpreter. It would need the following features:

  1. Interpreter flag to read file contents instead of timestamps
  2. Interpreter flag to export file contents to a series of files modified timestamps
  3. Ability to write comments inline without affecting the interpreter
    • Currently using the : character in documentation, but open to suggestion for
      something different
  4. (optional) Ability for the interpreter to reverse this process, including comments
    • i.e. Give the interpreter a list of regular Y2K files, read their timestamps, and output
      a "raw.y2k" file with inline comments.

The basic process should work like the following:


1 - Write a "raw.y2k" file

: raw.y2k
502 : Switch interpreter to 2 digit parsing

09 01 34 05 12 12 15 00 49 15 18 12 04 63 : Print "Hello World!"

00 00 : End print

2 - Test functionality with raw file

$ y2k -raw raw.y2k
Hello World!

3 - Convert raw file to regular Y2K files with their timestamps modified

$ y2k -convert raw.y2k
./1.y2k
./2.y2k
$ date +%s%9N -r 1.y2k
502090134051212150
$ date +%s%9N -r 2.y2k
104915181204630000

4 - Verify functionality of the newly created regular Y2K files

$ y2k .
Hello World!

This would make editing much easier, but also allow exporting for scenarios where proof of a 0-byte solution is needed.

Improve conditional termination

Right now while loops are terminated using the sequence 1999, while ifs are terminated using 2000. Neither is ideal for programs that need to use either of these values (i.e. setting a value to 2000 inside of an if statement would be problematic), but there has to be a numeric representation of terminating these sections that minimizes overlap with possible program values, while also not requiring a large number of digits to represent.

Float variable type

This might be kinda clunky to implement, but is definitely needed.

One approach could be to specify the size of a float value as length+1, with the last digit used for placement of the decimal. So to store the number 3.14, you would set variable size to 4 and the last digit would be 1 (decimal after the first digit).

So if the float variable type was type 4, the full statement would look like:

  Begin creating variable
 /   Set Var ID to 1 
|  /  Set var Type to 4 (float)
| |  /  Set var Size to 4
| | |  /  Insert 3
| | | |  /  Insert 1
| | | | |  /  Insert 4
| | | | | |  /  Insert 1 (set decimal after first digit)
| | | | | | |  /
8 1 4 4 3 1 4 1

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.