Posted 20 years ago
by Russell Mason

Hi
I'm completely new to SyntaxEditor and find it all a bit overwhelming!
I'm having a go at SQL with intellisence etc. (I'm sure this has been done many times before but unless someone wants to give me their code I'll just have to do it myself!).
What is the best way to approach this? In your SQL example language you treat SELECT, UPDATE, EXECUTE, all as reserved words. This would mean in the semantic parser I would know that a reserved word has been parsed but would then have to check the token text to see if it was SELECT or UPDATE or EXECUTE or even EXEC etc. Then step forward looking for identifiers which may be column names or table names and may or may not have a WHERE clause which again is simply a reserved word. Is this the way to proceed? or would it be better to more clearly define the language? having SELECT as its own token, which switches into a column list state which switches to a FROM state which may or may not switch to a WHERE state etc, etc. This would mean I know when I get a SelectToken that I am doing a select statement and would then be in a state that more clearly defines column base tokens etc.
The first approach seems like a simpler language but more complex coding; the second approach seems like a complex language but simpler coding. I'm not sure where the line is between SyntaxEditor being a syntax highlighter (simply colouring words) and where it can help in the difficult bit of knowing where you are in the code (more complex state related information).
Whilst your documentation is extensive it lacks a simple introduction for the beginner who has never tackled lexical and semantic parsing before.
Any help or tips would be appreciated.
Thanks
Russell Mason
I'm completely new to SyntaxEditor and find it all a bit overwhelming!
I'm having a go at SQL with intellisence etc. (I'm sure this has been done many times before but unless someone wants to give me their code I'll just have to do it myself!).
What is the best way to approach this? In your SQL example language you treat SELECT, UPDATE, EXECUTE, all as reserved words. This would mean in the semantic parser I would know that a reserved word has been parsed but would then have to check the token text to see if it was SELECT or UPDATE or EXECUTE or even EXEC etc. Then step forward looking for identifiers which may be column names or table names and may or may not have a WHERE clause which again is simply a reserved word. Is this the way to proceed? or would it be better to more clearly define the language? having SELECT as its own token, which switches into a column list state which switches to a FROM state which may or may not switch to a WHERE state etc, etc. This would mean I know when I get a SelectToken that I am doing a select statement and would then be in a state that more clearly defines column base tokens etc.
The first approach seems like a simpler language but more complex coding; the second approach seems like a complex language but simpler coding. I'm not sure where the line is between SyntaxEditor being a syntax highlighter (simply colouring words) and where it can help in the difficult bit of knowing where you are in the code (more complex state related information).
Whilst your documentation is extensive it lacks a simple introduction for the beginner who has never tackled lexical and semantic parsing before.
Any help or tips would be appreciated.
Thanks
Russell Mason