I am interested in sharing knowledge for the interest of the public. Here we learn how to contribute to a Wiki formatted content. http://bigbend.cs.utsa.edu/wiki/User:Morteza_shahriari_nia http://bigbend.cs.utsa.edu/wiki/POET_hands-on_guide To link a page to another page both of which contain the efinition of a phrase in different languages: Add [[en:Polyhedron]] at the end. en, fa, ... are the name of languages and Polyhedron is the name of the phrase you are interested in in the target language. OR vice versa [[fa:چندوجهی]] براي افزودن يك نام ديگر يك صفحه در ويكي (يك صفحه در ويكي وجود دارد و شما مي خواهيد جستجو براي يك نام ديگر آن صفحه خواننده را به همان صفحه ايي كه هست بكشاند بأيد يك تغيير مسير إيجاد كنيد: يك صفحه جديد با نام ديگر صفحه فعلي بسازيد و در آن صفحه تنها بگذاريد: #تغييرمسير ]]دكتر حشمت اله[[ #تغییرمسیر [[اسم صفحهٔ ۲]] External Linkin line with text put [kba-corpus] right in the middle. in the uttom of the document put [kba-corpus]: https://github.com/trec-kba/kba-corpus "kba-corpus" == '''A title that will be added to the contents menu in the beginning of the document definition.''' == * bullet ** sub-bullet <pre> is a box to write code in : indent '''bold word''' <code> make </code> Example Code: == '''Error Messages:''' == * Error: syntax is undefined for code template: ** Happens when calling a non-terminal that is not defined in the code or is defined after it has been accessed in tags. * Error: undefined symbol: * syntax error, unexpected LBR, expecting ENDTAG ** on: PRINT inputCodeAST[Stmts]; * Invalid assignment from returnType to "int" ** on: <pre> <xform lookupVariable pars=(arrayId) output=(returnType)> PRINT ("IN lookupVariable"arrayId); for(i = blockIndex; i >= 0; i = i- 1){ switch(arrayId){ } } </xform> </pre> == '''To add the syntax highlighting of POET to vim''' == *In home directory <pre> ::$ mkdir .vim ::$ cd !$ ::$ mkdir syntax ::$ cd !$ ::$ wget bigbend.cs.utsa.edu/pub/poet.vim //put your syntax file here ::$ vim ~/.vimrc //append /syntax to your ~/.vimrc </pre> == '''To remove an element from MAP''' == :Assign empty string to the desired key. Make sure that when initialising variables through something like a switch-case statement, it is not already defined or initialised. <pre> <xform traverseDeclaratorIdAssignmentList pars=(type, content, symbolTable)> switch('''content'''){ case CODE.DeclaratorIdAssignmentList1#(arrayId, declaratorIdAssignmentList) : symbolTable[arrayId] = type; switch(declaratorIdAssignmentList){ case CODE.DeclaratorIdAssignmentList#('''content1''') : traverseDeclaratorIdAssignmentList(type, content1, symbolTable); } } </xform> </pre> here, if you were to use '''content''' as the name of the variable to be filled in the inner switch, it will not fill out. ---- == '''AST - Rebuild Example''' == * First the caller <code>.pt</code> code (e.g. named <code>project.pt</code> file): <pre> <parameter inputFile type=STRING /> <parameter syntaxFile type=STRING /> <input to=inputAST from=inputFile syntax=syntaxFile /> <eval PRINT inputAST; /> </pre> * Second the <code>.code</code> file which includes the CFG of your language (e.g. <code>c.code</code> file) <pre> include utils.incl <define BACKTRACK TRUE /> <xform BuildExpr /> <code Stmts/> <code Stmt/> <code Expr/> <code Add_/> <code Add/> <code Add1/> <********************Expr**********************************> <code Bop pars=(op : STRING, opd1: Expr, opd2: Expr)> (opd1 op opd2) </code> <xform F pars=(inh, content)> switch (content){ case CODE.Add1#(term, add_): F(Bop#("+", inh, term), add_) case "" : inh case CODE.Add_#(v1): F(inh, v1) } </xform> <code Term pars=(content : INT) rebuild=(content)> @content@ </code> <code Add1 pars=(term : Term, add_ : Add_ ) > + @term@ @add_@ </code> <code Add_ pars=(content : Add1 | "")> @content@ </code> <code Add pars=(term: Term, add_ : Add_ ) rebuild=(XFORM.F(term, add_))> @term@ @add_@ </code> <code Expr pars=(add:Add) > @add@ </code> <********************Expr**********************************> <code ExprStmt pars=(content : CODE.Expr) rebuild=(content)> @content@ </code> <code Stmt pars=(content : ExprStmt ) rebuild=(content)> @content@ </code> <code Stmts parse=LIST(Stmt, "\n") /> <code Start pars=(content : CODE.Stmts) rebuild=(content)> @content@ </code> <define PARSE Start /> </pre> To run the program it is advisable to include the input and output file names in a file and make that file executable and call that. Here we made a file: <code>Makefile</code> make it executable and call it by just calling <code> make </code> in linux. <pre> DRIVER=project.pt GRAMMAR=C.code INPUT=test.c OUTPUT=test.out PCG=pcg DEBUG=-dp all: $(INPUT) $(GRAMMAR) $(DRIVER) $(PCG) $(DEBUG) \ -pinputFile=$(INPUT) \ -psyntaxFile=$(GRAMMAR) \ $(DRIVER) </pre> For a test file (e.g. <code>test.c</code>) as below: <pre> 2+3+4 </pre> The output would be <pre> Expr#Bop#( "+", Bop#( "+", 2, 3), 4) </pre> will look like this: http://bigbend.cs.utsa.edu/wiki/POET_hands-on_guide |