Skip to content

Instantly share code, notes, and snippets.

@jglrxavpok
Last active February 11, 2016 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jglrxavpok/60b9337aac44f58beaf8 to your computer and use it in GitHub Desktop.
Save jglrxavpok/60b9337aac44f58beaf8 to your computer and use it in GitHub Desktop.
WeaC Specifications

WeaC Specifications

Table of contents

TODO


Authors

'jglrxavpok'


Preface

WeaC (Abbreviation of Weak C) is an object-oriented (only code wise, Java primitives types are just wrapped inside WeaC classes) language attempting to mix C, Java and Scala concepts with a as little and simple as possible syntax. The language is still an experiment in order to learn how to make a compiler. It runs on the Java Virtual Machine and is designed to be used along side Java classes.


Syntax

WeaC languages are written in UTF-8 (expansion to Unicode planned). In contrary to Java or Scala, though they are supported in strings and character literals, Unicode escape characters are not supported inside code.

There are three big categories of tokens:

  • Keywords and identifiers: These tokens are started by a valid identifier start character.

Examples

Valid identifiers

Object, x, _, __someValue__, abc0145, afgy789dz, ANSWER_TO_LIFE_THE_UNIVERSE_AND_EVERYTHING, MyArray[]

Keywords

class, struct, public, protected, private, import, as, return, this, super, object, mixin, new, compilerspecial, package


* **Numbers**:
Numbers are tokens that start by a digit.
Number are by default written in base 10. Multiple base are supported by WeaC, here are how they are recognized:

| Base                           | Example               |
| :---------------               |----------------------:|
| 2 (Binary)                     | 0b1010101             |
| 16 (Hexadecimal)               | 0xCAFEBABE            |
| 8 (Octal)                      | 0o17451354            |
| C (Custom, up to 64)           | 0c3#120102, 0c5#10445 |
| (This limit will be modifiable)| (Base 3, Base 5)      |


* **Operators and special characters**:
___

> Specifications written by 'jglrxavpok' and inspired by [Scala 2.11's](http://www.scala-lang.org/files/archive/spec/2.11/).

> Written with [StackEdit](https://stackedit.io/).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment