On 11/09/18 19:49, Anthony Walter wrote: > > https://www.getlazarus.org/learn/language/lexical/ >
Nice, but the mouse over animation is pretty annoying [and unnecessary] though. I've also been maintaining my own Object Pascal Grammar (using FPC's objfpc mode only) in a EBNF (Extended Backus-Naur Form) like style. I include it as part of the FPC Language Reference (INF help) included with fpGUI. It might look confusing to some that don't understand EBNF syntax, but it really is pretty straight forward. Also with DocView's searching ability and highlighting search matches is is very quick to find the grammar of any Object Pascal language construct you are looking for. Here is a snippet of the grammar... ======================================== Goal -> (Program | Package | Library | Unit) Program -> [PROGRAM Ident ['(' IdentList ')'] ';'] ProgramBlock '.' Unit -> UNIT Ident [HintDirective] ';' InterfaceSection ImplementationSection InitSection '.' Package -> PACKAGE Ident ';' [RequiresClause] [ContainsClause] END '.' Library -> LIBRARY Ident ';' ProgramBlock '.' ProgramBlock -> [UsesClause] Block UsesClause -> USES IdentList ';' HintDirective -> deprecated [String] -> experimental -> library -> platform -> unimplemented InterfaceSection -> INTERFACE [UsesClause] [InterfaceDecl]... InterfaceDecl -> ConstSection -> TypeSection -> VarSection -> ExportedHeading ExportedHeading -> ProcedureHeading ';' [Directive] -> FunctionHeading ';' [Directive] ImplementationSection -> IMPLEMENTATION [UsesClause] [DeclSection]... [ExportsStmt]... Block -> [DeclSection] [ExportsStmt]... CompoundStmt [ExportsStmt]... ExportsStmt -> EXPORTS ExportsItem [, ExportsItem]... ExportsItem -> Ident [NAME|INDEX "'" ConstExpr "'"] [INDEX|NAME "'" ConstExpr "'"] DeclSection -> LabelDeclSection -> ConstSection -> TypeSection -> VarSection -> ProcedureDeclSection LabelDeclSection -> LABEL LabelId ConstSection -> CONST (ConstantDecl ';')... ConstantDecl -> Ident '=' ConstExpr [HintDirective] -> Ident ':' TypeId '=' TypedConstant [HintDirective] TypeSection -> TYPE (TypeDecl ';') TypeDecl -> Ident '=' [TYPE] Type [HintDirective] -> Ident '=' [TYPE] RestrictedType [HintDirective] TypedConstant -> (ConstExpr | ArrayConstant | RecordConstant) ArrayConstant -> '(' TypedConstant ',' ')' RecordConstant -> '(' RecordFieldConstant ';'... ')' RecordFieldConstant -> Ident ':' TypedConstant ....snip.... ======================================== Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal