I'm also up for suggestions to improve the review as I've not had a lot of time to go through it. I'm just going to take a look at the interpret function for now at least.
Print("Enter in one line of code at a time!") SOURCE_FILE = "Code/Python/Linny/script.linny" LOGIC_KEYWORDS = ĪLL_KEYWORDS = VARIABLE_KEYWORDS + LOGIC_KEYWORDS + FUNC_KEYWORDS + MISC_KEYWORDS #Dict of variables that have been initialized in the program Return variable in list(VARIABLES.keys()) """ Returns if the variable has already been defined """ Return word in VARIABLE_KEYWORDS and word not in LOGIC_KEYWORDS and word not in FUNC_KEYWORDS """ Determines if the passed word is a/possibly can be a variable """ If_logic_syntax_check(parse_if(line_number, lines)) Variable_syntax_check(line_number + 1, line) """ Converts the lines in the source file to a list"""įor line_number, line in enumerate(lines): """ Returns the if statement at the place in the file """ VARIABLES = float(new_value)Įxit(f"Cannot assign boolean value to have not been defined.")Įxit(f"Synta圎rror: Logic keyword not spelled correctly / not included.")ĭel statement, statementĮxit(f"Synta圎rror: Inconsistent Tabbing") """ Changes the value of the variable to the `new_value` """ĭata_type = VARIABLES """Interprets user inputed Linny code """
This program compiles and interprets programs written in `Linny` Type text // "type" returns the type of variable (integer, string, etc) Out text // "out" outputs the variable to the screen Syntax (sample file, script.linny) string text = "Hello" // semicolon MUST be one space away from ending You can also uncomment the bottom part in the main guard, comment out the for line in lines: interpret(line) part, and you'll be able to input line by line commands like Python. You set the path to the file in the source code, and you run it. You write a program in Linny, with the file extension. From performance to readability to bugs, anything. I want as much criticism and nitpick as you can find. I can't really say where I got the idea for the syntax, I just meshed a bunch of ideas from a wide range of languages and that's what I got. The interpreter is really a hybrid of a compiler/interpreter. It's an interpreted language, with the interpreter being written in Python 3. It's a very, very simple language, with only variable creation, variable changing, and outputting to the console, but I've very proud of it.
I've undertaken the project of creating my own programming language, Linny.