473,802 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

writing an interpreter for a simple language

Hi Everybody,

I need to write a simple interpreter (in C) for a very Simple language...
the language (was invented for the project) has only

variable or numbers (there are also built-in variables)
routines and expressions (routines can have recursion )

where can I find help and source code on that project...?

I heard this assignment is often given to students on programming courses...

Please Help,
Egal Konn
Nov 13 '05 #1
3 9735

"eyalkz" <ey****@openu.a c.il> wrote in message
news:1f******** *************** ***@posting.goo gle.com...
Hi Everybody,

I need to write a simple interpreter (in C) for a very Simple language...
the language (was invented for the project) has only

variable or numbers (there are also built-in variables)
routines and expressions (routines can have recursion )

where can I find help and source code on that project...?

I heard this assignment is often given to students on programming

courses...

Books on compilers should describe how to write parsers, which are the most
important part. You might also look to lex/flex and bison/yacc, tools to
make parser writing easier.

-- glen
Nov 13 '05 #2
eyalkz wrote:

Hi Everybody,

I need to write a simple interpreter (in C) for a very Simple language...
the language (was invented for the project) has only

variable or numbers (there are also built-in variables)
routines and expressions (routines can have recursion )

where can I find help and source code on that project...?

I heard this assignment is often given to students on programming courses...

Please Help,
Egal Konn


Try using YACC to generate your interpreter since you want it in C.

--
Julian V. Noble
Professor Emeritus of Physics
jv*@lessspamfor mother.virginia .edu
^^^^^^^^^^^^^^^ ^^^
http://galileo.phys.virginia.edu/~jvn/

"Science knows only one commandment: contribute to science."
-- Bertolt Brecht, "Galileo".
Nov 13 '05 #3
Hi,

try CioinaEval from http://www.delphipages.com/result.cfm?ID=3482

ey****@openu.ac .il (eyalkz) wrote in message news:<1f******* *************** ****@posting.go ogle.com>...
Hi Everybody,

I need to write a simple interpreter (in C) for a very Simple language...
the language (was invented for the project) has only

variable or numbers (there are also built-in variables)
routines and expressions (routines can have recursion )

where can I find help and source code on that project...?

I heard this assignment is often given to students on programming courses...

Please Help,
Egal Konn

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2413
by: Anon | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all I am a beginner teaching myself python, and I am enjoying it immensely :) As a language it is great, I real treat to study, I actually find it fun to study the language heh Anyways to the point of my post.....
13
4034
by: Rolf Magnus | last post by:
Hi, I would like to embed a python interpreter within a program, but since that program would be able to automatically download scripts from the internet, I'd like to run those in a restricted environment, which basically means that I want to allow only a specific set of modules to be used by the scripts, so that it wouldn't be possible for them to remove files from the hard drive, kill processes or do other nasty stuff. Is there any...
1
2057
by: Jonathan Fine | last post by:
I'm writing some routines for handling dvi files. In case you didn't know, these are TeX's typeset output. These are binary files containing opcodes. I wish to write one or more dvi opcode interpreters. Are there any tools or good examples to follow for writing a bytecode interpreter? I am already aware of opcode.py and other modules in
2
4533
by: eyalkz | last post by:
Hi all, I need help and source code in a school project the project is in c - building an interpreter for a simple (invented) language how do I implement: routines, variables and numbers... routines can also call other routines (recursion is allowed) do I need to build a symbol Table? what else? where can I found source code for that kind of project?
15
7777
by: Douglas Garstang | last post by:
All, I posted a newsgroup question here a few weeks back, asking some questions that related to my 10 year quest (so far) to understand pointers. Someone suggested I write a simple emulator. Part of his post is below. I would have emailed him directly but a valid email wasn't included.
6
2097
by: wooks | last post by:
Sorry if this is very basic. I have bought a Functional Programming book that uses the language Hope. I have managed to locate and extract Ross Pattersons hope interpreter from http://www.soi.city.ac.uk/~ros s/Hope/ However it seems what I have got is the C source code and I haven't got a clue what to do with it.
5
10649
by: Joel | last post by:
In the course of my project, I must include some custom logic and would like to integrate a small script language in my application for that purpose. In C++, I used the LUA script language and I know that bindings exists for a LUA/c# integration, but only using the binary DLL. However, I would prefer a native c# solution and for a small language, not a huge interpreter like Python. Has anybody seen such implementation ? Thanks,
5
1850
by: luvsat | last post by:
Hello all, I am new to python and working on a project that involves designing a new language. The grammar of the language is very much inspired from python as in is supports nearly all the statements and expressions that are supported by python. Since my project is in initial stage, so I think it would be appropriate if I clarify the following questions: 1. Would it make sense if I parse the whole program from scratch and then...
6
2038
by: Rafael Almeida | last post by:
Hello, I'm studying compilers now on my university and I can't quite understand one thing about the python interpreter. Why is its input a binary file (pyc)? The LOAD_CONST opcode is 100 (dec) and STORE_FAST's is 125 (dec). The translation of the following code: foo.py: x = 10
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10305
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9115
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.