Custom Language Compiler
h
Geocube101 (449)

This program (which took around 4 or 5 months) compiles a custom language into python for execution. It's not the most efficient language but it was just an idea.

There is now a basic tutorial in the tutorials folder. You can look over each file to see how to use this language

The custom language code will be (by default) compiled from the "program.ccl" file though this can be changed

Supported Functions

  • Variable creation: create <type> : <value> >> <name>
  • Variable modification: set <type> : <value> >> <name>
  • Variable calling: get [new] <type> : <value> >> <target>
  • Variable destruction: destroy <type> [: <name>]
  • Module Importing: import <type> : <path>
  • If statement: if (<condition>) {<code>}
  • Else if statement: else if (<condition>) {<code>}
  • Else statement: else {<code>}
  • While loop: while (<condition>) {<code>}
  • Unless loop: unless (<condition>) {<code>}
  • Once statement: once (<condition>)
  • Support for curly brace formatting
  • Support for functions: create function : <name>[args] >> {<code>}
  • Support for Error throwing: get [new] Error : <value/var_name> >> tracer
  • Support for classes: create class : <name> >> {<code>}
  • Init function: initialize<args> >> {<code>}
  • Support for "entry" hashes and arrays: create entry : <value> : <variable> <key/index/relative_operator>
  • Support "eval(string)" command
  • Support for single line comments: //
  • Support for multi-line comments: /* ... */
  • Support for "for" loop array iteration: for (<type> <name> : <iterable>) {<code>}
  • Support for empty block statements
  • Support for "for" loop range iteration: for (<type> <name> << <initial> : <name> <operator> <max> : <iter_count>)
  • Support for "try/handle" statements: try {<code>} handle(<error_variable>) {<code>}
  • Fixed tracer showing incorrect line numbers

Things WIP

  • Some built-in modules (Mainly the builtin "Thread" module)

Things Planned

  • Optional function parameters

Warnings

  • Still some issues with the for loop range iteration (especially with negatives)
  • Using try/handle will not exempt you from compilation errors (some compilation errors will be nullified when using this)

Please let me know about any bugs and also leave any features you would like to see added (I might add it in)
Note: This program is still being developed but the major things are done, so it may not always work

You are viewing a single comment. View All
Geocube101 (449)

@billehb I know, I'm currently trying to implement a new function