Subj : Parser generators for a simple language form. How? To : comp.programming From : Jon Ripley Date : Tue Aug 02 2005 07:33 pm This has been bugging me for a while and I'd appreciate some input. I have a number of simple scripting languages of similiar specifications that I use for rapid application development that I would like to make available to a wider audience. The wider audience use whichever operating system they want to on whatever platform they purchased. Currently they are all implemented in a non-portable language and whilst they suit my current needs perfectly they are of limited use to others and need to be recoded in a portable language to be compiled for whatever OS/platform any given user may want to use them on. My first choice for the portable language is C and these will all be command line tools. I would like to use a tool to generate the parser for each language, generally the only difference in the languages are the names of the functions and the parameters that they take. The format looks similiar to the C language - I decided that this would be the most transparent to the largest number of users. The general format is as follows: /* Multiline comment */ mylang( ) { Function1( , ); Function1( , ); Function2(); // Line comment Function3([]) { // can use data1; here if the last two parameters are // not-relevant, NULL or use default settings data1,"data1",flags; data2,"data2",flags; data3,"data3",flags; } Function4( ) [ Data here is passed straight to output as formatted ] } When FunctionX is encountered the values or pointers to values are stored in a structure specific to that function and are later used to create the desired output. A function may be used multiple times to declare different 'things' of the same type. Here's a working example made up on the spot that could be useful for rapid development of command line tools. It accepts a number of useful parameters including and when compiled would create a complete program shell in C for the described application. cligen(0) { CLIName("MyProg"); Version("1.00","01-01-1900"); Usage("ValidateOptions();","[-i] [[-o] ] [-h]"); Parameters() { "o","output",Optional,1,"OutFile"; "i","input",Required,1,"InFile"; "h","help",Optional,0,,"Help();"; } // Whitespace is only significant inside [] blocks Inline() [ void Help(void) { printf("Hello, World!\n"); } ] } Any suggestions for tools that I can use which would be appropriate for generating parsers for languages of this type? They should not be too difficult to learn as I want to spend the time porting the code rather than spending months working out how to use the parser generator. I have looked into yacc and bison but these don't seem to be appropriate and appear to have a huge learning curve. The worst case scenario and what I am currently facing is that I will need to write a scripting language of the above type that creates the C source code of scripting languages of the above type. Help is muchly appreciated as I am currently deadlocked, Jon Ripley -- http://jonripley.com/ .