Lethal Company
FEATURE REQUEST (CODING IN TERMINAL) [DESIGN DOC]
Here's a feature request for a modified COBOL scripting language for Lethal Company. Implementation details are provided below (I designed and implemented my own programming language for context).




Code sample:

START PROGRAM:
DISPLAY "Hello World"
PROCEDURE WEATHER
PROCEDURE SCAN
PROCEDURE PING "Zack"
END PROGRAM:




How to implement?

Need 4 classes for this
-Parser
-ScriptFSM
-ProcedureInstance (holds the procedure name and a List of String variables that serve as arguments to the procedure)
-DisplayInstance (holds a single String variable for the output)

Since we are not dealing with variables, if conditions, custom functions, or loops, it would be relatively simple to implement. Delimiter separates tokens via whitespace (not including those inside quotation marks).


Parser:
-enum typeof_operation [procedure, display]

typeof_operation(string line) --> Returns a typeof_operation enumerator

parse_procedure(string line) --> Returns instance of ProcedureInstance

parse_display(string line) --> Returns instance of DisplayInstance


ScriptFSM:
-hash_set<bool> procedure_functions [scan, ping, weather, ...] (prevents outputting duplicates and instead throws an error)

exe_code() --> void return (where the code is interpreted, uses Parser functions)

process_procedure(procedureinstance procedure) --> void return (simply use switch statements via the procedure name)

process_display(displayinstance display) --> void return (prints out the single string provided)




This design would work pretty well with Lethal Company's current CLI system. If you have any other questions regarding how to implement or are interested in any additional ideas, feel free to reach out to me via discord: zacktactical34
Τελευταία επεξεργασία από ZigZack; 14 Νοε 2023, 11:23
< >
Εμφάνιση 1-3 από 3 σχόλια
The overall vibe I get from using the terminal is 1980s tech, which is another reason I picked COBOL for inspiration. With the way I have it designed, the language would be Turing Incomplete (which means no infinite loops or recursion), it's a relatively simple syntax to parse, and the only procedures that can be executed are built-in options.

This fits both the vibe of the game and it offers a helpful tool for automation.
This is awesome, and as another developer of things thank you for including a design for it to stop people saying "but it's too hard!!!!!!!!!!!!!!!!!"
Αναρτήθηκε αρχικά από Noba:
This is awesome, and as another developer of things thank you for including a design for it to stop people saying "but it's too hard!!!!!!!!!!!!!!!!!"
Glad you like it! And yeah, people would most definitely say "ITS TOO HARD TO DO" XD
< >
Εμφάνιση 1-3 από 3 σχόλια
Ανά σελίδα: 1530 50

Ημ/νία ανάρτησης: 14 Νοε 2023, 11:16
Αναρτήσεις: 3