Share your repls and programming experiences

← Back to all posts
Custom Language Compiler
Geocube101 (623)

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


  • 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

Geocube101 (623)

@ChezCoder @EddieHozan @NikoBrooks @Kai_Justice @billehb @MatthewDoan @rediar @pyelias @Vandesm14 @theangryepicbanana
I added a few files in the "tutorial" folder of this repl for some information on how to use this language.

rediar (507)

@Geocube101 Maybe you should make a tutorial on the learn board.

Geocube101 (623)

@rediar Ok I'll start on that

Geocube101 (623)

@rediar I'm posting it in parts. The first part is up and is basically just the markdown files copied into the description

Geocube101 (623)

@billehb the main part of the program is complete as all necessary commands have been completed. All that remains are some modules.
Feel free to tell me of any bugs

billehb (16)

@Geocube101 ok, trying it out now

billehb (16)

it does not work

Geocube101 (623)

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

Geocube101 (623)

@billehb I've changed some stuff so it should work again
(Still trying to add the "handle" statement)

billehb (16)

@Geocube101 for me as soon as I run it it just says hello works and exits

Geocube101 (623)

@billehb That's all the code in the file. I don't currently have a docs for this but the custom code to compile goes into the "program.ccl" file.
All code to be executed is in that file and it's currently set to print "Hello World"

billehb (16)

@Geocube101 can you let me know egen you are done with the program (I know it can take a Long time I just sant to know when it is done)

ChezCoder (1616)

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

Geocube101 (623)

@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 (623)

@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"