Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

40%
+0 −1
Q&A How to initialize variable assignment in a non-OOP interpreter?

I'm still in the process of making MarkFuncs and having given up from copy-pasting open-source interpreters, them using OOP too, I decided to make one without OOP and with scratch alongside with th...

1 answer  ·  posted 3y ago by General Sebast1an‭  ·  last activity 3y ago by Canina‭

#1: Initial revision by user avatar General Sebast1an‭ · 2021-09-10T06:34:43Z (over 3 years ago)
How to initialize variable assignment in a non-OOP interpreter?
I'm still in the process of making [MarkFuncs](https://github.com/JoyrenceMatthewAgas/MarkFuncs) and having given up from copy-pasting open-source interpreters, them using OOP too, I decided to make one without OOP and with scratch alongside with the help of [**@Moshi**](https://software.codidact.com/users/53196) in the Discord server.

`test4` is where I'm currently at right now. [`interpreter.py`](https://tio.run/##vVbBbuM2ED1bXzGrRSEpcdx1ekuaU1G0BYpc2ls2DWhpbBOVSS1JxQ4MX3vosUB/cH8kHVIiJSuWsUWB@mKK8zjzOHwzZPVi1lJ88/q6VHIDTBvgm0oqA0ytIjfHha4wD/OarwQztcIoKnAJC2lMifpJLp8WiCoV9Sa7iSZ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RY2Z2iIq3e3gaNm7Zp0dh3y/zeM9qRCFrFfrkCfd5NIzOgC5rLmit8W@H4CeHLWhZ0b5AvsQ6ABbpDfdij@jiN8co3WZXjjgl1aPz9CQUyGxKSHccW2Ptv/o@rdXW5BN/1qLbOa5qGrS623oozp7fbXXVBrT1VTKeHqd/QM) currently has an output syntax for strings, and 2 functions that solve a challenge each in Code Golf CD. Right now, I want to do some math, in other words, deal with integers. The first problem to encounter, however is variable assignment.

I still have no idea how to get a specific keyword stored into the program and its value, then be reused and/or outputted. Here's what I have in mind for the syntax to be like:
```python
x=9;y=10;→x+y; # Full program
x=9            # Assign 9 in variable named x
   ;           # Semicolon to terminate the assigning process
    y=10       # Assign 10 in variable named y
        ;      # Semicolon to terminate the assigning process
         →x+y  # Output the sum of x and y (uses the in-progress calculate() function)
             ; # Semicolon to terminate the outputting process
```

<sup>This will be put in the Input section of the TIO link.</sup>

Since I'm not using OOP--and I want to keep it that way--, it'll be tricky to even make variable assigning possible, and that's why I need help here.

**Question**: How to make variable assigning possible in my Python-written interpreter?