mrredo / redolanguage Goto Github PK
View Code? Open in Web Editor NEWInterpreter for Redo Language
Interpreter for Redo Language
code
var bool = false
bool = true
print(bool) //output: false
Should be able to finish it tommorow morning, and else if statements work
when variable assigning at value convert it to a string and feed into govaluate function
and that goes for conditional stuff to add this to function arguments.
TEMPORARY FUNCTION FOR MATH IS math() it takes string as argument and outputs
Var e = 10
print(e%3) //returns mismatched type error
in lexer.If.Output method only takes the string expression without parsing the values, so create a new lexer object with expression string, tokenize it and run math expression token which returns a string with all parsed values
when token == "if":
ifPositions := mapOfPosIf[nestingLevel]
if ifPositions != nil:
position := len(ifPositions) + 1
ifPositions[position] = true
else:
mapOfPosIf[nestingLevel] = map[int]bool{1: true}
position = 1
nestingLevel++
// parse the expression and block of the if statement
// ...
when next_token == "}":
nestingLevel--
ifPositions = mapOfPosIf[nestingLevel]
if ifPositions != nil:
delete(ifPositions, len(ifPositions))
else:
mapOfPosIf[nestingLevel] = nil
when token == "else":
ifPositions := mapOfPosIf[nestingLevel]
if ifPositions != nil:
position := len(ifPositions) + 1
ifPositions[position] = true
nestingLevel++
// parse the block of the else statement
// ...
when next_token == "}":
nestingLevel--
when token == "else" && next_token == "if":
ifPositions := mapOfPosIf[nestingLevel]
if ifPositions != nil:
position := len(ifPositions) + 1
ifPositions[position] = true
else:
mapOfPosIf[nestingLevel] = map[int]bool{1: true}
position = 1
nestingLevel++
// parse the expression and block of the else if statement
// ...
when next_token == "}":
nestingLevel--
ifPositions = mapOfPosIf[nestingLevel]
if ifPositions != nil:
delete(ifPositions, len(ifPositions))
else:
mapOfPosIf[nestingLevel] = nil
print(o)
outputs: expected '(' after function name
but it should be: 'o' is not defined
Check for the variable if there's an unexpected token after the key and example
key() = value
it should throw
unexpected token '('
code
var test = 10
test += -10
2023/04/08 08:28:26 expected an integer, but got '-'
print((900+20)%2)
returns
2023/04/17 16:32:56 ./interpret.rd:1:15: syntax error: unbalanced parentheses%!(EXTRA []interface {}=[])
Since we want to avoid global variables, we need to implement these things
maybe create a new function meant for function arguments.
in this code
if true {
var e = 100;
if true {
println(e + e)//output: Mismatched type error
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.