Coder Social home page Coder Social logo

vurv78 / expressionscript Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 96 KB

Expression2 rewritten in Haxe

Home Page: https://vurv78.github.io/ExpressionScript

License: Apache License 2.0

Batchfile 0.05% Haxe 96.39% HTML 1.83% CSS 1.74%
expression2 wiremod programming-language garrysmod garrys haxe compiler transpiler hacktoberfest

expressionscript's Introduction

ExpressionScript Release Shield License Linter Badge github/Vurv78

Expression2 rewritten in Haxe.

⚠️ Notice ⚠️

This was a cool project, but I might've put too much of an emphasis on backwards compatibility, the one thing holding me back on E2 in the first place. Since I'm not making progress on this nor E2, you might want to see https://github.com/Vurv78/Expressive while this is on hold. It doesn't help that I've kind of fallen out of heart for Haxe. If this does come back, it may be in Rust ⚙️.

Readme

This was originally created to be a template to rewrite E2 for S&box, however at this point S&Box looks awful and I'm not interested in C#.
All credit and ownership of Expression2 goes to the wireteam & wiremod.

Transpiler

This project allows you to convert ExpressionScript code to any language, as long as a transpiler is provided.
By default a Lua transpiler is provided and more may come.

Differences

No normal

Normal is a type that came before number, however nobody uses it and it just complicates things.

No inputs

For obvious reasons, there's no io or entities in this as this is meant to be run in the browser, or simply on your pc.

Optimized

The language is optimized for speed. E2 was known to be very slow, and this is no longer the case through typing and other optimizations.
*Although, admittedly Haxe is nowhere near the best language for trying to get something to be fast.

General State

Here's a general status of each part of the language.

Name Status Desc
Preprocessor 🚧 No support for directives (I mean what would they do?). Of course they alongside comments are stripped out of code. Missing #ifdef, etc.
Tokenizer ✔️ Tokenizer should be completely finished. Some operators and grammar might be missing that I'm unaware of.
Parser 🚧🏗️ It is nearly done, however some things like #include are missing, and some statements/expressions might be buggy.
Optimizer Hasn't been started and there are no plans for this yet.
Compiler 🚧 I have not started work on this yet.
(Lua) Transpiler ✔️🏗️ Mostly done.
Tests ✔️ Unit tests are used to verify integrity of the language.

Running Tests

Tests are using the utest library.
Use haxe test.hxml to run them.

expressionscript's People

Contributors

derpius avatar keganpowers34 avatar vurv78 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

keganpowers34

expressionscript's Issues

Fix indexing operator

For some reason even though we accept a comma token it won't move past there. It will instead stay at the comma and not be able to accept a type token.

Repro

E[1,number]

Add #include statement

Add another statement in the parser that accepts #include "path". (Might also need to add a new keyword to tokenizer)
See https://github.com/wiremod/wire/wiki/Expression-2#include-directive for more info on what include is.

( It is basically just #include from languages like C++, except it is not through the preprocessor but it is turned into a function that runs in another scope.. yeah it's weird.. )

If you really want to go above and beyond you can also implement it in the lua transpiler side as just require(string).

Fix unit tests

Giving cryptic errors that I don't want to bother looking into right now.

Use hashlink

Hashlink is miles ahead of c++ for Haxe. Looks like it takes 1/10th of the time to compile, all into one neat file.

Null Safe

We should be able to enable --macro nullSafety("base", Strict)
Without any errors

No Dynamic

We don't want dynamic typing anywhere (It slows down statically typed targets (C++, Hashlink) by a LOT)

Here's where it's used

  • [Compiler] Temporary value for E2Context is of type Dynamic
  • [Lua Transpiler] call instruction
  • [Lua Transpiler] callInstruction
  • [Parser] Arguments passed to callInstruction are Dynamic, as we use reflection

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.