Adding examples and documentation

40 views
Skip to first unread message

Sha

unread,
Oct 28, 2017, 8:48:10 AM10/28/17
to lemon-lang
Hi,

Your fix worked on Raspberry Pi 3 and now there is no segfault, thanks very much!

And now some more questions:

1. I would like to add some examples to the repo. Would you consider adding /examples directory to the root of the project? Or do you have some other idea?

2. How can I contribute to the documentation of the project? I see there is /doc directory but it has only one README. 

3. How can I get the class of any object? How can I get id of any object if it exists?

4. Is there introspection so that I can get all methods of an object?

5. On the home page it is mentioned "Everything is object, integer, number, function, class even type." Where can I see example of function, class and even type becoming an object?

6. What is the class hierarchy of the system?

7. How can I read a text file line by line? When I use os.read(file) it reads the entire content, but I want to read it by line.

8. If you do:

    $  grep "^.\*" src/parser.c

    will you get the complete grammar of the language?

That's all for now :)
~ sha




admin

unread,
Oct 28, 2017, 9:07:02 AM10/28/17
to lemon-lang


On Saturday, October 28, 2017 at 8:48:10 PM UTC+8, Sha wrote:
Hi,

Your fix worked on Raspberry Pi 3 and now there is no segfault, thanks very much!

And now some more questions:

1. I would like to add some examples to the repo. Would you consider adding /examples directory to the root of the project? Or do you have some other idea?

absolutely not,You can post blog about example or discuss it,but the source code will not have some 'example'.
 

2. How can I contribute to the documentation of the project? I see there is /doc directory but it has only one README. 

The doc is the documentation of source code, not documentation of language.I wouldn't suggest you contribute any document if you may not very understand of how compiler or object system works.
 

3. How can I get the class of any object? How can I get id of any object if it exists?

There is no class for any object, everything is object, but not every object has class. class is just another object.you can see source code lclass.c that' the class.
 

4. Is there introspection so that I can get all methods of an object?

this is not implementation yet.
 

5. On the home page it is mentioned "Everything is object, integer, number, function, class even type." Where can I see example of function, class and even type becoming an object?

lfunction.c is function's object, lclass.c is class's object, everything start with 'l' is object (except lemon.c and lexer.c).
 

6. What is the class hierarchy of the system?

doesn't have. this is a language not a framework.
 

7. How can I read a text file line by line? When I use os.read(file) it reads the entire content, but I want to read it by line.

you can use string's split method. see demo.

```
>>> print('a\nb\nc\n'.split('\n'));
['a', 'b', 'c']
```
 

8. If you do:

    $  grep "^.\*" src/parser.c

    will you get the complete grammar of the language?

I'm will spent some time to review whole grammar and make a doc of it.
Reply all
Reply to author
Forward
0 new messages