Giter Site home page Giter Site logo

theonlymrcat / lok-r2 Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 440 KB

Compiler for the lok programming language.

License: Apache License 2.0

Makefile 1.11% M4 1.15% C++ 44.17% Yacc 42.92% Lex 5.63% Shell 5.02%
programming-language-development compiler programming-language

lok-r2's Introduction

Clok - Compiler for the Lok programming language

Build Status Build Status Discord server

This project is no longer being updated. As with all projects, it has turned into a mess of spaghetti, and I daren't touch it

This is a compiler for a programming language I am making called lok. Its goal is to have its syntax be as logical as possible. For now, snippets of the planned syntax can be seen in the test folder.

Design

Laws

The design laws I'm using making Lok are ones I think are logical.

1: The compiler is not allowed to search for identifiers (class names, function names, variable names, etc.) when trying to implement functionality. This means that, among other things, exceptions are not able to derive from one central class (like Throwable in Java) and foreach loops can't search for a begin() and end() function on classes. The main effect this has is to prohibit a main() function being used as the entry point, so I've replaced it with run declarations.

There is only one exception to this rule: bit, which is reserved so I can actually have a value type.

2: Whitespace anywhere in the code must be entirely optional. In more technical terms, for every valid source input, you must be able to remove all bytes 0x09, 0x0A and 0x20 and have it function exactly the same. This does not necessarily mean you are able to insert whitespace anywhere in the code and have it function, but you must be able to remove whitespace that is there.

Single-line comments are an exception to this rule. They are allowed to exist without closing syntax, and the test function will remove single-line comments.

Both of these design choices introduce challenges into creating the syntax and systems, notably the whitespace one because I have to define separators in place of whitespace where whitespace would be necessary.

lok-r2's People

Contributors

theonlymrcat avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.