The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
2answers
162 views

Should I use a formal grammar for my interpreted scripting language

I have a scripting engine I just published as an open source project. It's been sitting on my harddrive waiting for about a year. My engine of course isn't complete in any way, but it does work for ...
2
votes
2answers
234 views

Convert grammar into an LL(1) grammar which recognises the same language

I have the following sample question for a compilers exam and wanted to check my solution. Convert the following grammar into an LL(1) grammar which recognises the same language: E -> E + T E ...
-2
votes
1answer
190 views

Teaching English Grammar to a computer/software? [closed]

This Q may seem wierd, but I was stumbling by a thought of how can I teach a Computer a particular human language?? I am planning on a project where in a computer would, like any small human kid, be ...
0
votes
0answers
213 views

Steps in converting a grammar to LL(1) Grammar

I have the following question: Convert the following grammar into an LL(1) grammar which recognises the same language (you may assume that the grammar is unambiguous). A -> int A -> int + A A ...
5
votes
3answers
196 views

Constructing a Finite State Automaton

I have an exam question that I am unsure of the answer. The question is: In organisation X valid user names have the following structure. The user name can be either the employee’s name followed ...
4
votes
1answer
944 views

First and Follow Sets for a Grammar

I'm studying for a Compiler Construction module I'm doing and I have a sample question as follows: Calculate the FIRST and FOLLOW sets for the following grammar.. S -> uBDz B -> Bv B -> w D ...
3
votes
1answer
206 views

Showing a grammar is ambiguous

I have the following question taken from a compilers course exam: Show that the following grammar is ambiguous. S = XcY X = a Y = b | Z Z = bW W = d | ϵ I drew the following tree: Am I correct ...
3
votes
1answer
188 views

What is a real-world use case of using a Chomsky Type-I (context-sensitive) grammar

I have been having some fun lately exploring the development of language parsers in the context of how they fit into the Chomsky Hierarchy. What is a good real-world (ie not theoretical) example of a ...
1
vote
2answers
204 views

Good principles to explain the use of data objects

I'm in a little need of names clarification. First a brief description of my position. I prepare as debutant giving a junior developer job descriptions, which also provided another perspective on how ...
3
votes
1answer
111 views

How to support mixed grammars?

I am currently writing a grammar for a programming language (PowerBuilder) and I am also collecting documentation about parsing and compilers creation. Now I would like to add in my grammar (that ...
52
votes
11answers
3k views

Is it worth making a commit solely to resolve non-critical typos?

If I come across a non-critical typo in code (say, an errant apostrophe in a print(error) statement), is it worth making a commit to resolve that error, or should it simply be left alone? ...
5
votes
4answers
288 views

How are comments expressed in programming language grammars?

I'm learning how to build parsers using grammars, but I got stuck trying to express comments, because they can appear almost anywhere. This indicates that comments can be stripped from the token ...
0
votes
1answer
253 views

My potential customer has a very bad written English. Is that a red flag? [closed]

I am trying to start a freelancing career on oDesk. One of the potential employers offered me somewhat of a dream job: it's game development for an established company. The pay seems to be right ...
20
votes
6answers
2k views

Why the static data members have to be defined outside the class separately in C++ (unlike Java)?

class A { static int foo () {} // ok static int x; // <--- needed to be defined separately in .cpp file }; I don't see a need of having A::x defined separately in a .cpp file (or same file ...
3
votes
4answers
871 views

How can I extract words from a sentence and determine what part of speech each is?

I want to write something that takes a sentence and identifies each word it contains and defines what part of speech each word is. For example Hello World, I am a sentence would return this ...
4
votes
1answer
235 views

Visualizing a CUP grammar

I am implementing a grammar in CUP, and it would often be helpful to see everything at a glance. This could also be useful in finding errors quickly. Are there any programs out there that will ...
0
votes
3answers
330 views

Insert grammatical mistakes in a correct sentence

I'd like to insert grammatical mistakes (not typo) in a correct sentence, to make a small game. For instance: My name is John -> My name are John He leaves the room -> He leave the room I ...
3
votes
3answers
274 views

What makes one language any better than another when both are designed for the same goals? [closed]

I'm in the process of creating a grammar for a scripting language but as I'm working on it I started to wonder what makes a language good in the first place. I know the goals for my script but there ...
2
votes
1answer
190 views

Best way to parse optional grammar rules?

I started to write a hand written parser just for fun. For simple rules it is working, but I have problem with the optional grammar rules. I marked the optional rules with a question mark. Here is a ...
4
votes
3answers
2k views

Whats the difference between syntax and grammar?

I understand the difference between syntax and semantics - syntax - how the symbols are combined to form a valid expression or statement. semantics - the meaning of those symbols that form an ...
12
votes
3answers
605 views

How should I specify a grammar for a parser?

I have been programming for many years, but one task that still takes me inordinately long is to specify a grammar for a parser, and even after this excessive effort, I'm never sure that the grammar ...
6
votes
1answer
230 views

Using grammars to extract bibliographic citations

My task lays in the area of text mining / labelling, more particular extraction of bibliographic citations (references) from the plain text, as shown here: Basically, for the input text the ...
12
votes
6answers
445 views

Is saying “JSON Object” redundant?

If JSON stands for JavaScript Object Notation, then when you say JSON object, aren't you really saying "JavaScript Object Notation Object"? Would saying "JSON string" be more correct? Or would it be ...
7
votes
1answer
193 views

Should I let my users write BnfExpressions to extend my grammar?

Preface I'm designing a templating language (please skip the don't/why?? speech). One of the major goals of this language is to be extensible. There are 2 main elements in my language. "Tags" and ...
4
votes
3answers
199 views

Learning About Languages

I'm interested in learning more about programming languages. In particular, I'd like to look at some of the new developments in programming languages (even the really obscure ones that only academics ...
6
votes
6answers
441 views

Preferred lambda syntax?

I'm playing around a bit with my own C like DSL grammar and would like some oppinions. I've reserved the use of "(...)" for invocations. eg: foo(1,2); My grammar supports "trailing closures" , ...
74
votes
16answers
2k views

Should I point out spelling/grammar related mistakes in someone's code?

While reviewing a coworker's code, I came across some spelling mistakes in function names and also grammatical errors like 'doesUserHasPermission()' instead of 'doesUserHavePermission()' in function ...
7
votes
9answers
636 views

What are your thoughts on Periods/Full Stops in code comments?

I saw this asked in the SO Tavern, so I'm posting the question here. I thought it an interesting question. (Of course it doesn't belong on SO, but I think it's OK here.) Do you add periods (or, as ...