GithubHelp home page GithubHelp logo

redolanguage's Introduction

redolanguage's People

Contributors

exosyphon avatar mrredo avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

exosyphon

redolanguage's Issues

mathematical expression parsing and everything

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

IF statements: Only supports hard coded values

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

alogrithm to handle if/else if/else statements

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

unbalanced parentheses error

 print((900+20)%2)

returns

2023/04/17 16:32:56 ./interpret.rd:1:15: syntax error: unbalanced parentheses%!(EXTRA []interface {}=[])

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.