Formal Language
Link |
by
on 2008-11-27 19:04:32
|
I need a sample program (software) associated with formal language. It's supposed to be something that shows the application of Discrete Mathematics (in this case, formal language). Any proposals? :) m y . L i F E . i . t r a d e . i n . f o r . y o u r . P A i N . |
Re: Formal Language
| |
Well, i dont exactly know what you mean by "formal" but here's my program that i wrote for an assignment that finds the greatest common divisor(java)(that includes some math). import java.util.Scanner; public class GreatestCommonDivisor { public static void main(String [] args){ System.out.println("Program 6-5 Euclidean Algorithm"); System.out.println("Date: November 18, 2008"); System.out.println(""); Scanner reader = new Scanner(System.in); int input1,input2,output,s, remainder; System.out.print("Enter the first number: "); input1 = reader.nextInt(); System.out.print("Enter the second number: "); input2 = reader.nextInt(); if(input1 > input2){ while(input2 != 0){ remainder = input1%input2; input1 = input2; input2 = remainder; } System.out.println("The GCD is "+input1+"."); } else if(input2 > input1){ while(input1!=0){ remainder = input2%input1; input2=input1; input1=remainder; } System.out.println("The GCD is "+input2+"."); } } |
Re: Formal Language
Link |
by
on 2008-11-27 20:04:11
|
Formal Language. That's nice but I'm not exactly sure if it directly relates to formal language. [?] It's circulating more on the number theory. Thanks. :) m y . L i F E . i . t r a d e . i n . f o r . y o u r . P A i N . |
Re: Formal Language
Link |
by
on 2008-11-28 03:41:51 (edited 2008-11-28 03:44:42)
|
Can you give me a example output of that formal language that you really want to have? Although there are many codes that can sample a formal language like ... 1. Automatically solve simple problem in Automata or Discrete Math. 2. Turing Machine Simulation. (Possibly you can sample this) 3. Parent/Child Programming or most commonly done in Prolog. (Advance) 4. Tokenization (but I don't know if this applicable now). 5. Convert Numbers into Texts using parsing method. (I don't think if this applicable) 6. Parsing Simulation. 7. Context Free Grammar. ... and some more. That's why I can't even think on what Formal Language you want to have. There are many things you can code using formal language. You can ask your instructor about a simple example of formal language or just a hint program (only ask the name) if he can give you willingly. Possibly, you can find a source code about formal language or one of those possible example above in this site (www.planetsourcecode.com) or you can create a simple code or simmulation using the lessons just learn in Discrete Mathematics. |
Re: Formal Language
Link |
by
on 2008-11-30 20:15:28
|
About anything really (I think). Thanks for the info! :) m y . L i F E . i . t r a d e . i n . f o r . y o u r . P A i N . |