Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (kzhao, AndrewAMD, bigsmack, 7th_zorro), 869 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Simple SML parser and writer #339649
08/28/10 14:17
08/28/10 14:17
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
This is a simple script for parsing and writing SML files.

SML is an abbreviation for Superduper Markup Language or Small Markup Language or Simple Markup Language. You can choose whatever name you prefer.

SML is similar to XML in its structure, but has a different syntax. If you are familiar with XML or a similar markup language, understanding SML should be no problem.

The syntax looks like this:
Code:
#root_node
number 123.457
string "hello world"
{
    #node
    some_text '\'escaping'\ or "double quotes"'
    {
        #node
        string_list "one", "two", "three"
        
        /* block comment */
    }
}


The parser returns the root of the SML tree. Unicode is not supported. Editing SML trees is somewhat inconvenient at the moment, as I didn't need such functions yet. All functions are slightly documented in the headerfile. Most function prototypes should be self-explanatory.

You can download the whole stuff here: sml.zip. Demo script is included. You are free to do whatever you want to do with it. Might contain traces of bugs, so beware.

Re: Simple SML parser and writer [Re: Saturnus] #339694
08/28/10 17:54
08/28/10 17:54
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
It looks nice, but what is it for exactly? Do you write a script in SML and the parser converts it to lite-c?

Re: Simple SML parser and writer [Re: DJBMASTER] #339698
08/28/10 18:29
08/28/10 18:29
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
Cool, will have a look at it.
Could be useful to like make a level-setup or ai script.

Re: Simple SML parser and writer [Re: Damocles_] #339715
08/28/10 20:03
08/28/10 20:03
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
Originally Posted By: DJBMASTER
It looks nice, but what is it for exactly? Do you write a script in SML and the parser converts it to lite-c?

SML is just a markup language that describes hierarchically structured data. You can use it for storing game data such as configuration parameters (as Damocles mentioned), dialogues, character properties etc. By parsing a SML file its contents will not be translated to lite-C code, but mapped onto a tree structure that can be used/traversed in lite-C.

I hope this explains it better?

Re: Simple SML parser and writer [Re: Saturnus] #339730
08/28/10 20:51
08/28/10 20:51
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
Maybe you can add some examples how to browse through the nodes and read out properties,

Like setting up an ini-file, placing levelobjects or a conversation with subtexts.

Just like XML, its very useful to have an external
markup definition format, to structure content.

Re: Simple SML parser and writer [Re: Damocles_] #339738
08/28/10 21:30
08/28/10 21:30
Joined: Dec 2008
Posts: 271
Saturnus Offline OP
Member
Saturnus  Offline OP
Member

Joined: Dec 2008
Posts: 271
Yes, I must admit that the current demo script is not very useful as an example.

Adding more practical examples that concentrate on certain features or tasks is a good idea. I will add some in the next days.

The script will probably be used in a dialogue system. By implementing this, some handy functions for editing the tree will probably be added, too.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1