Custom Language Compiler
Geocube101 (589)

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
ChezCoder (1500)

Change the error line from No Variable Found Called 'VARIABLE NAME' to Couldn't find 'VARIABLE NAME'

Geocube101 (589)

@ChezCoder I could do that, though it may take some time as there are more than one line that checks and outputs a NameError

Geocube101 (589)

@ChezCoder I added a file (called "error_string.json") that allows for people to change the error strings (as I really liked the ones I had hard-coded in). Anyway, some strings use the format() method so those with "{}" in the string must always have "{}" in the string
More info in "tutorials/custom errors.md"