Trouble making an interpreter

Hello,
I'm making a small interpreter. I hope to get rid of compilers and start building my own programs & software by just only an interpreter :)

Currently :
1. I'm developing a feature that allows my interpreter to read multiple languages. For example, you can write your own code by your own mother language. But I have trouble reading a unicode text file. What should I do to check if the text file is unicode?

2. Is there any feature, idea that C++ doesn't have, but they should be in my interpreter? I like seeking for new features then add them, because, that would be great that I could start coding by my interpreter instead of a compiler.

Any help would be appreciated.

Here is what my interpreter can do so far :
1
2
3
4
5
6
7
8
9
10
11
  function @[Hello World](char *text) : arg2 // arg2 : variant
  {
    char *welcome_text = text;
    cout << welcome_text << "\n" << arg2 << endl;
  }

  // <$...> = is a comment
  @[Hello World](<$text> = "Hello world!", <$arg2> = "Nice to meet you.");
  
  system("pause");
  cout << "End..." << endl;


Edit : I just know a little English, I'm also a self-study C++ programmer and I'm just a 16 year-old student. I'm sorry if my writing is bad :)
Last edited on
You could make it just process Unicode and just forget about ASCII. That's what other scripted languages (like Ruby) do.
your english is actually quite good. some suggestions: built in string data type which c++ does not have. a built in generic type, switching on strings. could you explain what some of that code is? for example do you have to name a function as @[NAME]?
@kbw
You could make it just process Unicode and just forget about ASCII. That's what other scripted languages (like Ruby) do.

What a great idea! Sure I will try it out. Well, it should take some days I think...

@Little Bobby Tables
do you have to name a function as @[NAME]?

No. @[NAME] is an identifier. In fact, @[...] is used to create a "free-style" identifier; except for (']'), it can contain whitespaces, lines, symbols or whatever...

built in string data type which c++ does not have.

What do you mean by that? My interpreter supports std::string too, only the namespace std is removed. You can even use it in your expression (e.g : mystring = "abcde" + " defhi" + '\n' + '\0';)

a built in generic type, switching on strings.

Do you mean auto a, auto b or local a, local b? Well, I have considered it so many times, but actually this feature cannot be implemented. However, there are so many elements which are variant (I mean, their type can vary). For example, function arguments, function return values, etc. You can even use my built-in functions to access information of a variable and change its type, but I'm not sure if it is good :)
@Kikiman : switching on strings is something we could really use :).
Btw, does your interpreter read code and output C++? (something like a cross compiler?)
switching on strings is something we could really use :)

Well, I still don't get it. Maybe it would be better if you could provide some examples on it.

Btw, does your interpreter read code and output C++? (something like a cross compiler?)

No. IMO it's quite friendly, but many of its grammar are slightly different from C++. However, like you said before, it's like a cross compiler, and you can convert a C or C++ source file so that the file can work well with my interpreter.
Topic archived. No new replies allowed.